|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-06-25 00:40 UTC] trevorjohns at google dot com
Description: ------------ The include() function is supposed to return the return value of whatever code is present in a specified file, or int(1) if no return value is produced. However, when using the interactive shell (php -a), include() will always return int(1), assuming that the specified file was found. Note: This was discovered while I was investigating the following downstream bug in Zend Framework: http://framework.zend.com/issues/browse/ZF-7107. Also, this seems to be a duplicate of Bug #48056, but I can't find any explanation for why that bug was closed as bogus. Reproduce code: --------------- # Input to interactive shell var_dump(include('input.php')); # main.php (mirrors above input) <?php var_dump(include('input.php')); # input.php <?php return "It works!"; Expected result: ---------------- $php -a Interactive shell php > var_dump(include('input.php')); string(9) "It works!" $php main.php string(9) "It works!" Actual result: -------------- $php -a Interactive shell php > var_dump(include('input.php')); int(1) $php main.php string(9) "It works!" PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 20:00:01 2025 UTC |
Nope, it's still behaving the same as before: $ php --version PHP 5.3.0 (cli) (built: Jul 21 2009 17:54:37) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies $ php -a Interactive mode enabled <?php var_dump(include('input.php')); int(1))