cvs: pecl /phar func_interceptors.c /phar/tests opendir.phpt

From: Date: Sat, 12 Apr 2008 22:21:28 +0000
Subject: cvs: pecl /phar func_interceptors.c /phar/tests opendir.phpt
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-10358@lists.php.net to get a copy of this message
cellog Sat Apr 12 22:21:28 2008 UTC Added files: /pecl/phar/tests opendir.phpt Modified files: /pecl/phar func_interceptors.c Log: add test for opendir, fix bugs found http://cvs.php.net/viewvc.cgi/pecl/phar/func_interceptors.c?r1=1.9&r2=1.10&diff_format=u Index: pecl/phar/func_interceptors.c diff -u pecl/phar/func_interceptors.c:1.9 pecl/phar/func_interceptors.c:1.10 --- pecl/phar/func_interceptors.c:1.9 Sat Mar 22 22:11:48 2008 +++ pecl/phar/func_interceptors.c Sat Apr 12 22:21:28 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: func_interceptors.c,v 1.9 2008/03/22 22:11:48 cellog Exp $ */ +/* $Id: func_interceptors.c,v 1.10 2008/04/12 22:21:28 cellog Exp $ */ #include "phar_internal.h" @@ -51,7 +51,7 @@ char *name; efree(entry); - entry = filename; + entry = estrndup(filename, filename_len); /* fopen within phar, if :// is not in the url, then prepend phar://<archive>/ */ entry_len = filename_len; if (strstr(entry, "://")) { @@ -70,11 +70,9 @@ stream = php_stream_opendir(name, REPORT_ERRORS, context); efree(name); if (!stream) { - efree(entry); goto skip_phar; } php_stream_to_zval(stream, return_value); - efree(entry); return; } } http://cvs.php.net/viewvc.cgi/pecl/phar/tests/opendir.phpt?view=markup&rev=1.1 Index: pecl/phar/tests/opendir.phpt +++ pecl/phar/tests/opendir.phpt --TEST-- Phar: test opendir() interception --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip");?> --INI-- phar.require_hash=1 phar.readonly=0 --FILE-- <?php $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $a = new Phar($fname); $a['index.php'] = '<?php $a = opendir("dir"); while (false !== ($e = readdir($a))) { echo $e; } ?>'; $a['dir/file1.txt'] = 'hi'; $a['dir/file2.txt'] = 'hi2'; $a['dir/file3.txt'] = 'hi3'; $a->setStub('<?php Phar::interceptFileFuncs(); set_include_path("phar://" . __FILE__); include "index.php"; __HALT_COMPILER();'); include $fname; ?> ===DONE=== --CLEAN-- <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> --EXPECT-- file1.txtfile2.txtfile3.txt===DONE===

« previous php.pecl.cvs (#10358) next »