summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl')
-rw-r--r--ext/spl/internal/cachingiterator.inc2
-rw-r--r--ext/spl/spl_iterators.c19
-rw-r--r--ext/spl/tests/SplFileInfo_getInode_basic.phpt8
-rw-r--r--ext/spl/tests/SplFileInfo_getPerms_basic.phpt8
-rw-r--r--ext/spl/tests/iterator_031.phpt2
-rw-r--r--ext/spl/tests/spl_004.phpt6
6 files changed, 26 insertions, 19 deletions
diff --git a/ext/spl/internal/cachingiterator.inc b/ext/spl/internal/cachingiterator.inc
index 33258ab95..4d4bf8dbf 100644
--- a/ext/spl/internal/cachingiterator.inc
+++ b/ext/spl/internal/cachingiterator.inc
@@ -23,7 +23,7 @@
* flag CALL_TOSTRING to do the conversion when the actual element
* is being fetched. Otherwise the conversion would happen with the
* already changed iterator. If you do not need this then it you should
- * omit this flag because it costs unneccessary work and time.
+ * omit this flag because it costs unnecessary work and time.
*/
class CachingIterator implements OuterIterator
{
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index fcb4d20a6..25b8b4c12 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1013,12 +1013,12 @@ static void spl_recursive_tree_iterator_get_entry(spl_recursive_it_object * obje
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);
if (data && *data) {
RETVAL_ZVAL(*data, 1, 0);
- }
- if (Z_TYPE_P(return_value) == IS_ARRAY) {
- zval_dtor(return_value);
- ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1);
- } else {
- convert_to_string(return_value);
+ if (Z_TYPE_P(return_value) == IS_ARRAY) {
+ zval_dtor(return_value);
+ ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1);
+ } else {
+ convert_to_string(return_value);
+ }
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
}
@@ -1119,8 +1119,15 @@ SPL_METHOD(RecursiveTreeIterator, current)
}
}
+ INIT_ZVAL(prefix);
+ INIT_ZVAL(entry);
spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC);
spl_recursive_tree_iterator_get_entry(object, &entry TSRMLS_CC);
+ if (Z_TYPE(entry) != IS_STRING) {
+ zval_dtor(&prefix);
+ zval_dtor(&entry);
+ RETURN_NULL();
+ }
spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC);
str_len = Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix);
diff --git a/ext/spl/tests/SplFileInfo_getInode_basic.phpt b/ext/spl/tests/SplFileInfo_getInode_basic.phpt
index 902cbb31c..380b865cd 100644
--- a/ext/spl/tests/SplFileInfo_getInode_basic.phpt
+++ b/ext/spl/tests/SplFileInfo_getInode_basic.phpt
@@ -16,15 +16,15 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms
<?php
//file
-touch ('test_file_ptfi');
-$fileInfo = new SplFileInfo('test_file_ptfi');
-$result = shell_exec('ls -i test_file_ptfi');
+touch ('SplFileInfo_getInode_basic.txt');
+$fileInfo = new SplFileInfo('SplFileInfo_getInode_basic.txt');
+$result = shell_exec('ls -i SplFileInfo_getInode_basic.txt');
var_dump($fileInfo->getInode() == $result);
?>
--CLEAN--
<?php
-unlink('test_file_ptfi');
+unlink('SplFileInfo_getInode_basic.txt');
?>
--EXPECTF--
bool(true)
diff --git a/ext/spl/tests/SplFileInfo_getPerms_basic.phpt b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt
index e9b7beaa9..53591f341 100644
--- a/ext/spl/tests/SplFileInfo_getPerms_basic.phpt
+++ b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt
@@ -16,15 +16,15 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms
<?php
//file
-touch ('test_file_ptfi');
-chmod('test_file_ptfi', 0557);
-$fileInfo = new SplFileInfo('test_file_ptfi');
+touch ('SplFileInfo_getPerms_basic.txt');
+chmod('SplFileInfo_getPerms_basic.txt', 0557);
+$fileInfo = new SplFileInfo('SplFileInfo_getPerms_basic.txt');
var_dump($fileInfo->getPerms() == 0100557);
?>
--CLEAN--
<?php
-unlink('test_file_ptfi');
+unlink('SplFileInfo_getPerms_basic.txt');
?>
--EXPECTF--
bool(true)
diff --git a/ext/spl/tests/iterator_031.phpt b/ext/spl/tests/iterator_031.phpt
index 40342f4bb..8bd3ca7c5 100644
--- a/ext/spl/tests/iterator_031.phpt
+++ b/ext/spl/tests/iterator_031.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: AppendIterator::append() rewinds when neccessary
+SPL: AppendIterator::append() rewinds when necessary
--FILE--
<?php
diff --git a/ext/spl/tests/spl_004.phpt b/ext/spl/tests/spl_004.phpt
index 97896f815..d56f48f89 100644
--- a/ext/spl/tests/spl_004.phpt
+++ b/ext/spl/tests/spl_004.phpt
@@ -43,8 +43,8 @@ var_dump(iterator_apply($it, 'test'));
echo "===ERRORS===\n";
var_dump(iterator_apply($it, 'test', 1));
-var_dump(iterator_apply($it, 'non_existing_functon'));
-var_dump(iterator_apply($it, 'non_existing_functon', NULL, 2));
+var_dump(iterator_apply($it, 'non_existing_function'));
+var_dump(iterator_apply($it, 'non_existing_function', NULL, 2));
?>
===DONE===
@@ -77,7 +77,7 @@ int(4)
Error: Argument 3 passed to iterator_apply() must be of the type array, integer given
Error: iterator_apply() expects parameter 3 to be array, integer given
NULL
-Error: iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_functon' not found or invalid function name
+Error: iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name
NULL
Error: iterator_apply() expects at most 3 parameters, 4 given
NULL