summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2014-06-01 19:42:20 +0800
committerXinchen Hui <laruence@php.net>2014-06-01 19:42:20 +0800
commitc4e7c7d50e14749a9ab49caf8ca7b78d2f9d13a5 (patch)
treef96c2194bd7bf329152a83099585824f6bc61e44 /ext
parentb8042acdde8caaa1660eb56e6b56a161c25b7408 (diff)
parent0218e4eb19c080d131c2b4d75ef9543e0e12c146 (diff)
downloadphp-git-c4e7c7d50e14749a9ab49caf8ca7b78d2f9d13a5.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
Diffstat (limited to 'ext')
-rw-r--r--ext/spl/spl_directory.c2
-rw-r--r--ext/spl/spl_iterators.c2
-rw-r--r--ext/spl/tests/bug67359.phpt28
3 files changed, 32 insertions, 0 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 03315b7bb1..4159d1ae34 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -829,6 +829,7 @@ SPL_METHOD(DirectoryIterator, seek)
zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), &intern->u.dir.func_rewind, "rewind", &retval);
if (retval) {
zval_ptr_dtor(&retval);
+ retval = NULL;
}
}
@@ -838,6 +839,7 @@ SPL_METHOD(DirectoryIterator, seek)
if (retval) {
valid = zend_is_true(retval);
zval_ptr_dtor(&retval);
+ retval = NULL;
}
if (!valid) {
break;
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 679fc85af1..cade34efd4 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -848,6 +848,8 @@ static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char
*object_ptr = zobj;
function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len, key TSRMLS_CC);
}
+ } else {
+ *object_ptr = zobj;
}
}
return function_handler;
diff --git a/ext/spl/tests/bug67359.phpt b/ext/spl/tests/bug67359.phpt
new file mode 100644
index 0000000000..e2e61133f3
--- /dev/null
+++ b/ext/spl/tests/bug67359.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #67359 (Segfault in recursiveDirectoryIterator)
+--FILE--
+<?php
+try
+{
+ $rdi = new recursiveDirectoryIterator(dirname(__FILE__), FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS);
+ $it = new recursiveIteratorIterator( $rdi );
+ $it->seek(1);
+ while( $it->valid())
+ {
+ if( $it->isFile() )
+ {
+ $it->current();
+ }
+
+ $it->next();
+ }
+
+ $it->current();
+}
+catch(Exception $e)
+{
+}
+echo "okey"
+?>
+--EXPECTF--
+okey