php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45749 interactive mode hangs on simple input
Submitted: 2008-08-07 23:52 UTC Modified: 2009-06-20 01:00 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: mazzarelli at gmail dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.2.6 OS: Ubuntu 8.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-08-07 23:52 UTC] mazzarelli at gmail dot com
Description:
------------
when running a bit of code from the command line, it works. Running the same code interactively causes it to hang.

Reproduce code:
---------------
<?php
// example1.php
if (false) {
  try {} catch (Exception $e) {}
}
?>

<?php
// example2.php
function stop_the_madness () {
  static $i;
  if (++$i > 1) exit("WTF?!\n");
}

stop_the_madness();

if (false) {
  try {} catch (Exception $e) {}
}

exit("A-OK\n");
?>

Expected result:
----------------
In the first snippet, nothing should happen. But when that is in a file, and require_once'ed from the interactive shell, it hangs.

In the second example, when ran from CLI, it says A-OK. But when ran interactively, it says "WTF?!"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-08 01:39 UTC] mazzarelli at gmail dot com
In case it wasn't clear, I forgot to mention what seems to be happening.

In interactive mode, upon reaching the "if (false)" containing a try/catch block, the interactive session tries to include the file again. This never stops and in continually includes the file over and over. If you change the function to print out $i, you will see this clearly.

If the condition is "true", it exhibits the correct behavior. False, or a condition that evaluates to false, introduces the bug.
 [2008-08-08 14:12 UTC] lbarnaud@php.net
Reproducing:

$ php -a
Interactive shell

php > include "example2.php";
WTF?!
 [2009-06-03 23:22 UTC] asti at informatik dot uni-kiel dot de
Hi! 
I have the same problem
OS: Fedora 9
uname -r :2.6.27.24-78.2.53.fc9.i686
php -v: 5.2.9(cli)

Everything worked fine until I made the following combination of bash-commands:
su;pear upgrade-all;<trying to get an external libary to work>;pecl install pdflib;pear install File_PDF;yum -y install php-Zend*;

The External libaries was fpdf(aquired from their homepage).

Trying to get the pdf-routines to work caused a segfault.
Looking back all startet using pear upgrade-all ;

So I uninstalled php and all of it's components and manually clensed the system from any reamainds of php-files(required for the interpreter to run) and Config-files using locate,updatedb and rm -fr.
And made several reboots.

After that I reinstalled php step by step.
yum -y install php; worked well.
The interpreter runs good but as soon as I 
execute require_once(),include() or require() using the Interactive shell I get a Segmentation fault.
This fault remained after I reinstalled the pearcomponents.
yum -y install php-pear*;

The strange things is that the skripts running on my Apache(Version 2.2.9(Unix)) are executing normally but grepping through the logs of the server I get a stacktrace everytime I executed a script containing one of the 3 functions mentioned earlier.
sincerly
 [2009-06-12 14:23 UTC] felipe@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-06-20 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 03:02:51 2024 UTC