]> granicus.if.org Git - php/commitdiff
- Fixed bug #52573 (SplFileObject::fscanf Segmentation fault)
authorFelipe Pena <felipe@php.net>
Tue, 10 Aug 2010 22:37:24 +0000 (22:37 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 10 Aug 2010 22:37:24 +0000 (22:37 +0000)
ext/spl/spl_directory.c
ext/spl/tests/bug52573.phpt [new file with mode: 0644]

index cc049a1e27b021f4c18feeb4579d1fe90c26d657..fe3262ba429908fdc920a8a272c69bf18a1d2cd1 100755 (executable)
@@ -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 (file)
index 0000000..17f2984
--- /dev/null
@@ -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