ID: 48682
User updated by: trevorjohns at google dot com
Reported By: trevorjohns at google dot com
-Status: Feedback
+Status: Open
Bug Type: Scripting Engine problem
Operating System: Mac OS X 10.5.8 / Arch Linux
PHP Version: 5.2.10
New Comment:
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)
Previous Comments:
------------------------------------------------------------------------
[2009-07-30 05:03:20] [email protected]
Works for me in 5.3. Does it work for you with current 5.3?
------------------------------------------------------------------------
[2009-07-21 13:01:11] [email protected]
See also bug #49000
------------------------------------------------------------------------
[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