summaryrefslogtreecommitdiff
path: root/ext/spl/spl_array.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-03-22 21:57:10 +0000
committerAntony Dovgal <tony2001@php.net>2006-03-22 21:57:10 +0000
commite0cd1b87a8759b3d345d53f57f0e6d6e732abb73 (patch)
treed93d8cebcd929e2645653ca9390742bbc70d03f5 /ext/spl/spl_array.c
parentaf0ac4f3bc7d391a27076376e3b39fce06dfd542 (diff)
downloadphp-git-e0cd1b87a8759b3d345d53f57f0e6d6e732abb73.tar.gz
MFH: fix #36825 (Exceptions thrown in ArrayObject::offsetGet cause segfault)
fix similar issue in offsetExists() remove redundant semicolons
Diffstat (limited to 'ext/spl/spl_array.c')
-rwxr-xr-xext/spl/spl_array.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index e01b61faf8..f758eeb2cc 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -291,7 +291,11 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", &rv, offset);
zval_ptr_dtor(&intern->retval);
MAKE_STD_ZVAL(intern->retval);
- ZVAL_ZVAL(intern->retval, rv, 1, 1);
+ if (rv) {
+ ZVAL_ZVAL(intern->retval, rv, 1, 1);
+ } else {
+ ZVAL_NULL(intern->retval);
+ }
return intern->retval;
}
}
@@ -422,11 +426,13 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o
if (check_inherited && intern->fptr_offset_has) {
zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset);
- if (zend_is_true(rv)) {
+ if (rv && zend_is_true(rv)) {
zval_ptr_dtor(&rv);
return 1;
}
- zval_ptr_dtor(&rv);
+ if (rv) {
+ zval_ptr_dtor(&rv);
+ }
return 0;
}
@@ -1337,43 +1343,43 @@ SPL_METHOD(Array, getChildren)
static
ZEND_BEGIN_ARG_INFO(arginfo_array___construct, 0)
ZEND_ARG_INFO(0, array)
-ZEND_END_ARG_INFO();
+ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_array_offsetGet, 0, 0, 1)
ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
+ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_array_offsetSet, 0, 0, 2)
ZEND_ARG_INFO(0, index)
ZEND_ARG_INFO(0, newval)
-ZEND_END_ARG_INFO();
+ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO(arginfo_array_append, 0)
ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
+ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO(arginfo_array_seek, 0)
ZEND_ARG_INFO(0, position)
-ZEND_END_ARG_INFO();
+ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO(arginfo_array_exchangeArray, 0)
ZEND_ARG_INFO(0, array)
-ZEND_END_ARG_INFO();
+ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO(arginfo_array_setFlags, 0)
ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO();
+ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO(arginfo_array_setIteratorClass, 0)
ZEND_ARG_INFO(0, iteratorClass)
-ZEND_END_ARG_INFO();
+ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO(arginfo_array_uXsort, 0)