From: trevorjohns at google dot com Operating system: Mac OS X 10.5.8 / Arch Linux PHP version: 5.2.10 PHP Bug Type: Scripting Engine problem Bug description: include() ignores return value when running in interactive shell
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!" -- Edit bug report at http://bugs.php.net/?id=48682&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48682&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48682&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48682&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48682&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48682&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48682&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48682&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48682&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48682&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48682&r=support Expected behavior: http://bugs.php.net/fix.php?id=48682&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48682&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48682&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48682&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48682&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48682&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48682&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48682&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48682&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48682&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48682&r=mysqlcfg
