From: Johannes Schlüter Date: Fri, 23 Oct 2009 16:47:35 +0000 (+0000) Subject: Fix #49972 (AppendIterator undefined function crash) X-Git-Tag: php-5.4.0alpha1~191^2~2466 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64400b87241453ffe7eb126464bfa7757dcd5d05;p=php Fix #49972 (AppendIterator undefined function crash) --- diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 0d9476e66c..a32bfd8b24 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1215,7 +1215,7 @@ static union _zend_function *spl_dual_it_get_method(zval **object_ptr, zstr meth intern = (spl_dual_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC); function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC); - if (!function_handler) { + if (!function_handler && intern->inner.ce) { if (zend_u_hash_find(&intern->inner.ce->function_table, IS_UNICODE, method, method_len+1, (void **) &function_handler) == FAILURE) { if (Z_OBJ_HT_P(intern->inner.zobject)->get_method) { *object_ptr = intern->inner.zobject; diff --git a/ext/spl/tests/bug49972.phpt b/ext/spl/tests/bug49972.phpt new file mode 100755 index 0000000000..843c2519ba --- /dev/null +++ b/ext/spl/tests/bug49972.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #49972 (AppendIterator undefined function crash) +--FILE-- +undefined(); + +?> +--EXPECTF-- +Fatal error: Call to undefined method AppendIterator::undefined() in %s on line %d