ID:               48682
 Updated by:       j...@php.net
 Reported By:      trevorjohns at google dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Mac OS X 10.5.8 / Arch Linux
 PHP Version:      5.2.10
 New Comment:

See also bug #49000


Previous Comments:
------------------------------------------------------------------------

[2009-06-25 00:40:52] 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!"


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48682&edit=1

Reply via email to