php.net |  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: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: james dot zimmerman at trnxs dot net
New email:
PHP Version: OS:

 

 [2009-08-28 23:11 UTC] james dot zimmerman at trnxs dot net
Description:
------------
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 (http://us3.php.net/manual/en/function.include.php), 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;
1
php > echo $bar;
1
php > exit


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

php > echo $foo;
PHP
php > echo $bar;
1

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-31 12:07 UTC] svn@php.net
Automatic comment from SVN on behalf of jani
Revision: http://svn.php.net/viewvc/?view=revision&revision=287915
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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 30 22:01:30 2025 UTC