From:             [EMAIL PROTECTED]
Operating system: Linux 2.6.18-gentoo
PHP version:      5.2.0RC5
PHP Bug Type:     Scripting Engine problem
Bug description:  Endless loop when for exception thrown on E_RECOVERABLE_ERROR

Description:
------------
When the error thrown by SWFMovie::save is catched by the error handler
and "converted" to an exceptions this results in an endless loop.

Tested with 5.2-RC5 and 5.2-RC6-dev.

I tested this with another E_RECOVERABLE_ERROR thrown by a wrong return
value of __toString, which does not cause the endless loop, so that it is
perhaps ming related.

Reproduce code:
---------------
<?php

function errorHandler($errno, $errstr, $errfile, $errline)
{
    throw new Exception( 'An error occured.' );
}

set_error_handler( 'errorHandler' );

$movie = new SWFMovie();

$image = new SWFBitmap( file_get_contents(
'http://kore.phpugdo.de/jpg.jpeg' ) );
$object = $movie->add( $image );

$movie->save( 'test.swf' );


Expected result:
----------------
PHP Fatal error:  Uncaught exception 'Exception' with message 'An error
occured.' in /path/file.php

Actual result:
--------------
Endless loop

Shortened backtrace after a SIGINT, which made me assume, that is a
problem in the scripting engine:

#0  0x083ea725 in _zend_mm_alloc_int (heap=0x871b3f8, size=16,
__zend_filename=0x86b89e4
"/home/kore/bin/php/php-5.2-cvs/php-src/Zend/zend.c", __zend_lineno=962, 
    __zend_orig_filename=0x0, __zend_orig_lineno=0) at
/home/kore/bin/php/php-5.2-cvs/php-src/Zend/zend_alloc.c:1080
#1  0x083eb91a in _emalloc (size=16, __zend_filename=0x86b89e4
"/home/kore/bin/php/php-5.2-cvs/php-src/Zend/zend.c", __zend_lineno=962,
__zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at
/home/kore/bin/php/php-5.2-cvs/php-src/Zend/zend_alloc.c:1640
#2  0x08406d45 in zend_error (type=4096, format=0x869d417 "%s") at
/home/kore/bin/php/php-5.2-cvs/php-src/Zend/zend.c:962
#3  0x083b6a1c in php_verror (docref=0x88478b4 'Z' <repeats 79 times>,
"\204&#65533;\217*Zu", params=0x869cee5 "", type=4096, format=0x86639f9
"%s", 
    args=0xbf87997c "4q\204\bp&#65533;\207\bXZ") at
/home/kore/bin/php/php-5.2-cvs/php-src/main/main.c:584
#4  0x083b6a81 in php_error_docref0 (docref=0x0, type=4096,
format=0x86639f9 "%s") at
/home/kore/bin/php/php-5.2-cvs/php-src/main/main.c:596
#5  0x081d7433 in php_ming_error (msg=0xb7d7ffa0 "Unexpected end of Jpeg
file (EOF found)!") at
/home/kore/bin/php/php-5.2-cvs/php-src/ext/ming/ming.c:4027
#6  0xb7d64403 in methodWriteJpegFile () from /usr/lib/libming.so.0

-- 
Edit bug report at http://bugs.php.net/?id=39196&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39196&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39196&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39196&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39196&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39196&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39196&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39196&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39196&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39196&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39196&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39196&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39196&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39196&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39196&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39196&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39196&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39196&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39196&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39196&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39196&r=mysqlcfg

Reply via email to