mardi 4 mars 2014

PHP require_once ignored unless I error_log the return code?


Vote count:

0




Ok, most bizarre PHP error I've ever encountered.


I have a Joomla module that has a startup.php which includes several files:



...
require_once(SYS_PATH . 'json.php');
require_once(SYS_PATH . 'utf8.php');
...


On one deployment, this reveals an error that the utf8.php is clashing with another set of utf8 functions from a different module. That part makes sense.


The bizarre unexplained part is that I have a second deployment (the dev site) where this problem is not occurring. After debugging, I determined that the 'utf8.php' is not getting loaded at all. The require_once is simply not happening. BUT, if I try printing the return value of require_once, then it DOES include the file and reveal the exception.



// DOES NOT run any code in utf8.php
...
require_once(SYS_PATH . 'json.php');
error_log('loading utf8.php');
require_once(SYS_PATH . 'utf8.php');
...


-



// DOES run the code in utf8.php
...
require_once(SYS_PATH . 'json.php');
error_log( 'loading utf8.php' );
error_log( 'require returns ' . require_once(SYS_PATH . 'utf8.php') );
...


I literally just add or remove the "error_log" wrapper around the existing code, and it starts working or stops working.


Does anyone have ANY insight into this??


Also: I have added error_log statements before and after this statement and within this and other required files, and they all show up in the log, and the page loads fine (when the require isn't happening on utf8 module). All file permissions are identical.


Linux 3.10.17 Apache 2.2.20 PHP 5.3.6



asked 56 secs ago






Aucun commentaire:

Enregistrer un commentaire