Rasmus Lerdorf wrote:
After poking this a bit more, it looks like this whole block of code in
main.c is redundant. Here is the story:
We start our journey on a dark and stormy night in June 2002 with this
bug: http://bugs.php.net/17720
This led to this fix:
http://cvs.php.net/viewcvs.cgi/php-src/main/main.c?r1=1.461&r2=1.462
which had this commit message:
Main script should not be parsed when (include|require)_once()'ed, #17720
# Derick, MFH?
Now, at the time this was the correct fix. However, fast forward to
March 2005 and we have a patch from Stas to zend_execute_scripts:
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend.c?view=diff&r1=1.297&r2=1.298
which adds the opened file to the included_files list. This means that
we are now trying to add the main script to the included_file list twice
which in itself is bad.
We'll test this a bit more, but it looks safe to remove that block of
code. The test case in bug 17720 works fine without that block of code
in main.c and I see no other reason to have it there.
Just as a final follow-up to this. Further testing showed that in CLI
mode where we pass in a ZEND_HANDLE_FP instead of a ZEND_HANDLE_FILENAME
we still need this block of code. So the fix is to check and only skip
this block if we are passed a ZEND_HANDLE_FILENAME. Commit coming up.
-Rasmus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php