We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10208 ☆ A M B ☆
    • 1,780 Posts
    Yesterday I moved/copied a development site to localhost. The server that it was on, is weird. To say the least. I had upgraded to PHP 5.3 (MODX system info says 5.3.13) in the CGI console and was told that even if it didn't show on their cp server info page that it was indeed upgraded.

    On local, I'm running PHP 5.3.8.

    So, unless debug is turned off in system settings I see errors on the pages. There is one for bookmarkThis and a huge list of errors for mxCalendar. Both snippets work however.

    mxCalendar errors:

    Notice: Undefined index: cid in C:\xampp\htdocs\lilocounseling\core\cache\includes\elements\modsnippet\102.include.cache.php on line 180

    Warning: Invalid CRT parameters detected in C:\xampp\htdocs\lilocounseling\core\model\modx\filters\modoutputfilter.class.php on line 445

    (the above Invalid CRT Parameters error displays multiple times after this, I can't count them...Many many times)


    Just above the bookmark this output, I see this:

    Notice: Undefined variable: dev in C:\xampp\htdocs\lilocounseling\core\cache\includes\elements\modsnippet\101.include.cache.php on line 34

    In modoutputfilter.class.php at line 441 is this:

     /* See PHP's strftime - http://www.php.net/manual/en/function.strftime.php */
                                if (empty($m_val))
                                    $m_val = "%A, %d %B %Y %H:%M:%S"; /* @todo this should be modx default date/time format? Lexicon? */
                                $value = 0 + $output;
                                if ($value != 0 && $value != -1) {
                                    $output= strftime($m_val,$value);
                                } else {
                                    $output= '';
                                }
                                break;


    If I remove both && from line 444 the manger and front end errors:

    Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\lilocounseling\core\model\modx\filters\modoutputfilter.class.php on line 444

    Removing one & fixes the front end and manager, yet the Invalid CRT error still shows.

    When I remove both &&, the file referenced in the bookmarkThis error disappeared. When I replaced them, it re-loaded in NP++. When I removed them again, it did not disappear (not exist) again.

    The file from the bookmarkThis error is as follows:

    <?php
    function elements_modsnippet_101($scriptProperties= array()) {
    global $modx;
    if (is_array($scriptProperties)) {
    extract($scriptProperties, EXTR_SKIP);
    }
    /**
     * BookmarkThis v1.2.2 pl
     *
     * Copyright 2011 by Mad About Brighton <[email protected]>
     * 
     *(blah blah all the license stuff was here, I removed it for space reasons)
     *
     * You should have recieved a copy of the license. If not, it can be viewed by visiting 
     * http://madaboutbrighton.net/projects/bookmarkthis
     *
     * @package bookmarkthis
     */
    
    /**
     * BookmarkThis for MODx Revolution 2.*+
     *
     * @package bookmarkthis
     */
    
    $path = ($dev == 1) ? $modx->getOption('base_path') . '/dev/' : $modx->getOption('core_path');
    
    require_once $path.'components/bookmarkthis/model/bookmarkthis/bookmarkthis.class.php';
    
    $mabBookmarkThis = new mabBookmarkThis($modx, $scriptProperties);
    
    $s = $mabBookmarkThis->getBookmarkThis();
    
    unset($mabBookmarkThis);
    
    return $s;
    }
    


    Line 27 in the above code seems to be the invalid variable it's calling out. I couldn't find anything in the bookmarkThis.class file for "dev". I honestly don't know what I'm doing... sorry. A PHP class is sounding better and better even if it's not for credit.

    The development site in a subfolder on the server doesn't create these errors. My point in moving the site is to prepare to move it again to my server (which is actually running PHP 5.2.17 but apparently I can enable 5.3 in .htaccess if I want) if they can't figure out their path issues at the client server.

    Good news is, I'm not seeing any more path errors on local. It did not however solve the problem with fileUpload not finding the upload path. A new thread for that one though.

    I can continue with debug off, but it seems wrong to do so. No?



      Frogabog- MODX Websites in Portland Oregon
      "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
      Having server issues? These guys have MODX Hosting perfected - SkyToaster
      • 3749
      • 24,544 Posts
      It has mostly to do with the error_reporting level. PHP 5.3 throws a lot of warnings and notices for many MODX extras. The errors are almost always harmless and you can hide them by creating a php.ini file in the MODX root with something like this:

      error_reporting = E_ALL & ~E_NOTICE | E_STRICT | E_DEPRECATED


      You'll still see any real errors.

      That said, I like seeing the errors so I can let the extra authors know about the problem (especially if I'm the author wink ).


      The 'Parse error: syntax error, unexpected T_VARIABLE' error is a real error in the output modifiers file. It could suggest that the file was corrupted during the transfer. Maybe it got truncated after that line (it has over 600 lines).

      My totally wild guess on the $dev error is that this line should go above the one with the error:

      $dev = $scriptProperties['dev'];


      or, probably safer and better,

      $dev = $modx->getOption('dev', $scriptProperties, 0, true);


      This would also probably be OK, since I'm guessing that the code is only there so the extra will run in the author's development environment.

      $dev = 0;


      BTW, make sure you have the latest version of FileUpload. It was updated recently.


      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 10208 ☆ A M B ☆
        • 1,780 Posts
        Thank You Bob. As always, you are here to save me. Much appreciated.

        I'm a little confused however about the cache\includes\elements\modsnippet\101.include.cache.php file. How is this file generated? I don't see making changes in the cache just to possibly clear them out someday when I do a manual clear (which is much faster and simpler now that it's local).

        FileUpload btw is running 1.0.4-pl, and I'm seeing this on both local and remote. Everything seems on the up and up but it can't get the path, neither with TV nor directly in the call. I forgot to make a new thread.

        Think I'm gonna go catch some crabs in Seaside tomorrow, so I better get on it tonight.
          Frogabog- MODX Websites in Portland Oregon
          "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
          Having server issues? These guys have MODX Hosting perfected - SkyToaster
          • 3749
          • 24,544 Posts
          The cache file is generated the first time the snippet is called after the cache is cleared.

          There's no point in editing the cache file. You need to edit the code of the snippet with the ID of 101, and be aware that your changes will be lost if you upgrade or re-install the package containing the snippet (though the author may have fixed the problem).


          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting