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

Reply via email to