From:             pierre at guinoiseau dot eu
Operating system: FreeBSD / Ubuntu
PHP version:      5.4.5
Package:          Reproducible crash
Bug Type:         Bug
Bug description:Interactive php-cli crashes if include() is used in 
auto_prepend_file

Description:
------------
Hello,

this bug may be related to bug #49000. php-cli crashes in interactive mode
if 
you do an include() in auto_prepend_file. An example will explain it better
(see 
test scripts):
  % php -d auto_prepend_file=prepend.php -a
  Interactive mode enabled
  
  test 1
  test 2
  Ran out of opcode space!
  You should probably consider writing this huge script into a file!

This was tested with PHP 5.4.5 (from ports) on FreeBSD 8.1 and PHP 5.4.4
(from 
Debian Git repository) on Ubuntu 12.04.

No error if the include file is missing (only the usual warning).

Also, I got another very weird case...
The provided prepend_segfault.php segfaults instead of the error above:
  % php -d auto_prepend_file=prepend_segfault.php -a
  Interactive shell
  
  test 1
  zsh: segmentation fault (core dumped)  php -d 
auto_prepend_file=prepend_segfault.php -a

But there is no segfault and no errors if I remove "$toto = 1".

If I replace one (or both) if/elseif conditions with true or false, it
execute 
the script 2 times instead on 5.4.4 (and it segfaults on 5.4.5):
% php -d auto_prepend_file=prepend_towtimes.php -a
  Interactive shell
  
  test 1
  test 1 bis
  test 1
  test 1 bis
  test 2
  php > 

Of course if I remove the include() line, everything is back to normal.

Something is very wrong, isn't it? :)

Test script:
---------------
// prepend.php => weird error
<?php
echo "test 1\n";
include("include.php");
?>

// include.php
<?php
echo "test 2\n";
?>

// prepend_segfault.php => segfaults
<?php
$toto = 1;
if (php_sapi_name() == "cli") {
} elseif (php_sapi_name() == 'fpm-fcgi') {
}
echo "test 1\n";
include("include.php");
?>

// prepend_towtimes.php => script is executed two times (5.4.4) or
segfaults (5.4.5)
<?php
$toto = 1;
if (true) {
} elseif (false) {
}
echo "test 1\n";
echo "test 1 bis\n";
include("include.php");
?>


Expected result:
----------------
No weird behaviour and not segfaults when I use include() in an
auto_prepend_file 
in interactive mode.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=62661&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62661&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62661&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62661&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62661&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62661&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62661&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62661&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62661&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62661&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62661&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62661&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62661&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62661&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62661&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62661&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62661&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62661&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62661&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62661&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62661&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62661&r=mysqlcfg

Reply via email to