diff options
author | Felipe Pena <felipe@php.net> | 2010-08-10 22:37:24 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2010-08-10 22:37:24 +0000 |
commit | c10bb27254ed67a30e358eb673936de66ee0543f (patch) | |
tree | be75fd2eaac3f001589baf643fcb7319291aa0f3 /ext | |
parent | e0b728597b9cccd072005613f3427be32fae2826 (diff) | |
download | php-git-c10bb27254ed67a30e358eb673936de66ee0543f.tar.gz |
- Fixed bug #52573 (SplFileObject::fscanf Segmentation fault)
Diffstat (limited to 'ext')
-rwxr-xr-x | ext/spl/spl_directory.c | 6 | ||||
-rw-r--r-- | ext/spl/tests/bug52573.phpt | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index cc049a1e27..fe3262ba42 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1865,7 +1865,11 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function result = zend_call_function(&fci, &fcic TSRMLS_CC); - ZVAL_ZVAL(return_value, retval, 1, 1); + if (result == FAILURE) { + RETVAL_FALSE; + } else { + ZVAL_ZVAL(return_value, retval, 1, 1); + } efree(params); return result; diff --git a/ext/spl/tests/bug52573.phpt b/ext/spl/tests/bug52573.phpt new file mode 100644 index 0000000000..17f2984dfb --- /dev/null +++ b/ext/spl/tests/bug52573.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #52573 (SplFileObject::fscanf Segmentation fault) +--FILE-- +<?php + +$result = null; +$f = new SplFileObject(__FILE__, 'r'); +$f->fscanf('<?php // %s', $result); + +?> +--EXPECTF-- +Warning: Parameter 3 to fscanf() expected to be a reference, value given in %s on line 5 |