bjori Mon Nov 6 15:20:23 2006 UTC
Modified files:
/php-src/ext/spl spl_directory.c
/php-src/ext/spl/tests fileobject_003.phpt
Log:
Fix segfault on $splinfo->openFile()->getPath()
Improve test
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.101&r2=1.102&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.101
php-src/ext/spl/spl_directory.c:1.102
--- php-src/ext/spl/spl_directory.c:1.101 Fri Oct 13 14:52:19 2006
+++ php-src/ext/spl/spl_directory.c Mon Nov 6 15:20:23 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.101 2006/10/13 14:52:19 andrei Exp $ */
+/* $Id: spl_directory.c,v 1.102 2006/11/06 15:20:23 bjori Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -406,6 +406,8 @@
} else {
intern->file_name = source->file_name;
intern->file_name_len = source->file_name_len;
+ intern->path = estrndup(source->path, source->path_len);
+ intern->path_len = source->path_len;
intern->u.file.open_mode = "r";
intern->u.file.open_mode_len = 1;
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_003.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/spl/tests/fileobject_003.phpt
diff -u php-src/ext/spl/tests/fileobject_003.phpt:1.2
php-src/ext/spl/tests/fileobject_003.phpt:1.3
--- php-src/ext/spl/tests/fileobject_003.phpt:1.2 Sat Jul 15 13:01:44 2006
+++ php-src/ext/spl/tests/fileobject_003.phpt Mon Nov 6 15:20:23 2006
@@ -31,6 +31,9 @@
var_dump($f->getPath());
$l = substr($f->getPath(), -1);
var_dump($l != '/' && $l != '\\' && $l == $lp);
+
+ $fo = $o->openFile();
+ var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath());
}
test(dirname(__FILE__) . '/' . 'fileobject_001a.txt', 't',
substr(dirname(__FILE__),-1));
@@ -56,6 +59,9 @@
bool(true)
string(%d) "%stests"
bool(true)
+string(%d) "%sfileobject_001a.txt"
+string(%d) "%sfileobject_001a.txt"
+string(%d) "%stests"
===1===
object(SplFileInfo)#%d (0) {
}
@@ -71,6 +77,9 @@
bool(true)
string(%d) "%sspl"
bool(true)
+string(%d) "%stests"
+string(%d) "%stests"
+string(%d) "%stests"
===2===
object(SplFileInfo)#1 (0) {
}
@@ -86,4 +95,7 @@
bool(true)
string(%d) "%sspl"
bool(true)
+string(%d) "%stests"
+string(%d) "%stests"
+string(%d) "%sspl"
===DONE===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php