|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49405 PHP CLI (php -a) does not function correctly on include and related functions.
Submitted: 2009-08-28 23:11 UTC Modified: 2009-08-31 12:07 UTC
From: james dot zimmerman at trnxs dot net Assigned:
Status: Closed Package: CGI/CLI related
PHP Version: 5.2.10 OS: Linux (Ubuntu 9.04)
Private report: No CVE-ID:
 [2009-08-28 23:11 UTC] james dot zimmerman at trnxs dot net
Discovered first trying to utilize Zend_Http_Client from the interactive PHP command line.  Any include call using CLI interactive mode will always report the boolean return value of the include operation, regardless of whether a return() statement is included or not in the included file.  A more precise description would be that if you attempt to run Example #5 from the include() description page (, it will echo two "11" and not the expected "PHP1".  This does not appear to affect simply running the file as an argument to the php command, ie "$ php testreturns.php", only the interactive CLI mode (php -a).

Reproduce code:
Interactive shell

php > $foo = include 'return.php';
php > $bar = include 'noreturn.php';
php > echo $foo;
php > echo $bar;
php > exit

Expected result:
Should have echoed "PHP" when echoing the $foo variable.

php > echo $foo;
php > echo $bar;

Actual result:
php > echo $foo;
php > echo $bar;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-31 12:07 UTC]
Automatic comment from SVN on behalf of jani
Log: MF53: - Fixed bug #49000 (PHP CLI in Interactive mode (php -a) crashes when including files from function), see also bug #49405
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 14:01:30 2015 UTC