We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28840
    • 46 Posts
    Hi to everyone here...
    I’ve run into a problem which is quite confusing...
    situation is this:
    i have i php code, that works perfectly if it is a direct test.php file on server, but if i try it in snippet in modx I get the following resoult:
    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »
     
    PHP error debug
      Error: 	unpack(): Type H: outside of string	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	openSRS_base.php	 
      Line: 	839	 
      Line 839 source: 	$temp = unpack('H*temp', $data); 	 
     
    Parser timing
      MySQL: 	0.0018 s	(4 Requests)
      PHP: 	1.2241 s	 
      Total: 	1.2259 s


    I checked the problem on php.net and there was a bug reporterd about this exact problem and de-buged in version PHP5.2
    The confusion part is followed -> Why does the same code works in pure php file, but not in snippets which are "pure raw PHP"???
    I guess that updating of PHP is the solution, but updating is up to my hosting provider which is out of my hands...
    So guys...asking you for help... is there some kind of php compiler inside Modx that still has the bug?
    System: Linux CentOS & Apache & PHP 4 & Modx 0.96

    Any suggestions?

    Sumoborac
      • 28840
      • 46 Posts
      Ok, after 48 hours of hittin my head against computer, trying to figure it out i got this far...
      the problem is within modx, php version is out the window...As far as I understand it, modx has its own evalSnippet() and phpError which are reporting this problems... is there some kind of workaround for phpError response?

      Is there anyone who can help me here?



      Sumoborac
        • 22303 MODX Staff
        • 10,725 Posts
        Are you trying to suppress the php errors on unpack() using the @ operator? It’s really unclear what you are doing. If that is the issue, you might want to check out the latest in subversion from http://svn.modxcms.com/svn/tattoo/tattoo/branches/0.9.6 -- this is the current development branch for 0.9.6.2 release. A change was submitted a few days ago to address some error suppression problems people were reporting on certain platforms.

        If you don’t want to upgrade, the change is simple adding this line as the first line of the phpError() function in manager/includes/document.parser.class.inc.php:
        if (error_reporting() == 0) return true;
          • 28840
          • 46 Posts
          Ok, situation is like this... I’m working on php-based application that is using opensrs_base library. And inside this library is a line, that makes modx jump up...(the library is availible at http://sourceforge.net/projects/opensrs-php/)
          Modx can’t get over unpack() with star ( * ) in it...I’m just including the file inside a snippet...
          I’ll try phpError suggestion, for now I’m using CURL to get around the problem :s


          Sumoborac