#39196 [Opn->Bgs]: Endless loop when for exception thrown on E_RECOVERABLE_ERROR

From: Date: Thu, 19 Oct 2006 13:53:59 +0000
Subject: #39196 [Opn->Bgs]: Endless loop when for exception thrown on E_RECOVERABLE_ERROR
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-103732@lists.php.net to get a copy of this message
ID: 39196 Updated by: tony2001@php.net Reported By: kore@php.net -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux 2.6.18-gentoo PHP Version: 5.2.0RC5 New Comment: Not PHP problem. Code like this is supposed to result in endless loop (ming-0.3.0/src/blocks/jpeg.c:142): for ( ;; ) { if ( SWFInput_getChar(input) != JPEG_MARKER ) SWF_error("Jpeg marker not found where expected!"); <skip> } Previous Comments: ------------------------------------------------------------------------ [2006-10-19 11:55:37] kore@php.net 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 this bug report at http://bugs.php.net/?id=39196&edit=1

« previous php.bugs (#103732) next »