cvs: ZendEngine2(PHP_5_2) / zend_execute_API.c /tests bug41421.phpt

From: Date: Fri, 18 May 2007 11:52:08 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_execute_API.c /tests bug41421.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5806@lists.php.net to get a copy of this message
tony2001 Fri May 18 11:52:08 2007 UTC Added files: (Branch: PHP_5_2) /ZendEngine2/tests bug41421.phpt Modified files: /ZendEngine2 zend_execute_API.c Log: MFH: fix #41421 (Uncaught exception from a stream wrapper segfaults) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.19&r2=1.331.2.20.2.20&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.19 ZendEngine2/zend_execute_API.c:1.331.2.20.2.20 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.19 Fri Apr 27 08:12:24 2007 +++ ZendEngine2/zend_execute_API.c Fri May 18 11:52:08 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.19 2007/04/27 08:12:24 tony2001 Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.20 2007/05/18 11:52:08 tony2001 Exp $ */ #include <stdio.h> #include <signal.h> @@ -675,6 +675,10 @@ } if (fci->object_pp) { + if (Z_TYPE_PP(fci->object_pp) == IS_OBJECT + && (!EG(objects_store).object_buckets || !EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(fci->object_pp)].valid)) { + return FAILURE; + } /* TBI!! new object handlers */ if (Z_TYPE_PP(fci->object_pp) == IS_OBJECT) { if (!IS_ZEND_STD_OBJECT(**fci->object_pp)) { @@ -839,6 +843,10 @@ calling_scope = fci_cache->calling_scope; fci->object_pp = fci_cache->object_pp; EX(object) = fci->object_pp ? *fci->object_pp : NULL; + if (fci->object_pp && Z_TYPE_PP(fci->object_pp) == IS_OBJECT + && (!EG(objects_store).object_buckets || !EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(fci->object_pp)].valid)) { + return FAILURE; + } } if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) { http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug41421.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/bug41421.phpt +++ ZendEngine2/tests/bug41421.phpt --TEST-- Bug #41421 (Uncaught exception from a stream wrapper segfaults) --FILE-- <?php class wrapper { function stream_open() { return true; } function stream_eof() { throw new exception(); } } stream_wrapper_register("wrap", "wrapper"); $fp = fopen("wrap://...", "r"); feof($fp); echo "Done\n"; ?> --EXPECTF-- Warning: feof(): wrapper::stream_eof is not implemented! Assuming EOF in %s on line %d Fatal error: Uncaught exception 'Exception' in %s:%d Stack trace: #0 [internal function]: wrapper->stream_eof() #1 %s(%d): feof(Resource id #6) #2 {main} thrown in %s on line %d

« previous php.zend-engine.cvs (#5806) next »