|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-05-08 08:50 UTC] krzysin at gmail dot com
Description:
------------
Failed opening required file, php 4, 5, ...
Reproduce code:
---------------
<?
require("2") || print "dd";
?>
Expected result:
----------------
PHP Warning: require(1): failed to open stream: No such file or directory in /root/test.php on line 3
Warning: require(1): failed to open stream: No such file or directory in /root/test.php on line 3
PHP Fatal error: require(): Failed opening required '1' (include_path='.:/usr/local/lib/php') in /root/test.php on line 3
Fatal error: require(): Failed opening required '1' (include_path='.:/usr/local/lib/php') in /root/test.php on line 3
Actual result:
--------------
#0 0x37b62373 in fprintf () from /lib/libc.so.6
#1 0x08368ff9 in sapi_cli_log_message (
message=0x37ad8ef8 "PHP Fatal error: require(): Failed opening required '1' (include_path='.:/usr/local/lib/php') in /root/test.php on line 3")
at /build/www/php5/php/sapi/cli/php_cli.c:313
#2 0x08278a18 in php_log_err (
log_message=0x37ad8ef8 "PHP Fatal error: require(): Failed opening required '1' (include_path='.:/usr/local/lib/php') in /root/krzysin/test.php on line 3")
at /build/www/php5/php/main/main.c:505
#3 0x082794d3 in php_error_cb (type=64, error_filename=0x37ad8a38 "/root/test.php", error_lineno=3, format=0x8575e4c "%s", args=0x3fd23b9c)
at /build/www/php5/php/main/main.c:904
#4 0x0817b5af in soap_error_handler (error_num=64, error_filename=0x37ad8a38 "/root/test.php", error_lineno=3, format=0x8575e4c "%s", args=0x3fd23b9c)
at /build/www/php5/php/ext/soap/soap.c:2178
#5 0x082b9dbe in zend_error (type=64, format=0x8575e4c "%s") at /build/www/php5/php/Zend/zend.c:967
#6 0x08279083 in php_verror (docref=0x8576231 "function.require", params=0x8575c8e "", type=64, format=0x8576200 "Failed opening required '%s' (include_path='%s')",
args=0x3fd23c60) at /build/www/php5/php/main/main.c:721
#7 0x082790cb in php_error_docref0 (docref=0x8576231 "function.require", type=64, format=0x8576200 "Failed opening required '%s' (include_path='%s')")
at /build/www/php5/php/main/main.c:733
#8 0x08279c6e in php_message_handler_for_zend (message=2, data=0x37ad8cb8) at /build/www/php5/php/main/main.c:1119
#9 0x082b9c50 in zend_message_dispatcher (message=2, data=0x37ad8cb8) at /build/www/php5/php/Zend/zend.c:894
#10 0x0829960d in compile_file (file_handle=<incomplete type>, type=8) at /build/www/php5/php/Zend/zend_language_scanner.c:3410
#11 0x082997a8 in compile_filename (type=8, filename=0x3fd24e7c) at /build/www/php5/php/Zend/zend_language_scanner.c:3465
#12 0x082e5b6e in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER (execute_data=0x3fd24efc) at /build/www/php5/php/Zend/zend_vm_execute.h:4583
#13 0x082d5c0e in execute (op_array=0x37ad896c) at /build/www/php5/php/Zend/zend_vm_execute.h:92
#14 0x082ba242 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /build/www/php5/php/Zend/zend.c:1134
#15 0x0827afa1 in php_execute_script (primary_file=0x3fd27264) at /build/www/php5/php/main/main.c:2005
#16 0x0836a404 in main (argc=2, argv=0x3fd272f4) at /build/www/php5/php/sapi/cli/php_cli.c:1140
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 07:00:01 2025 UTC |
There is no bug here... The '1' occurs because the expression '("2") || print "dd"' results in TRUE. The require isn't a function, it's statement and thus, the '()' did confuse you.