From: Steph Fox Date: Mon, 7 Jul 2008 01:09:21 +0000 (+0000) Subject: Duplicate tests to accommodate parameter parsing fixes in 5_3 core X-Git-Tag: php-5.3.0alpha1~470 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5db08e7d1f6d3af3222cf849c356ac2c1cb3f7d0;p=php Duplicate tests to accommodate parameter parsing fixes in 5_3 core (NB the 5_2 tests will fail currently due to name changes, will fix tomorrow) --- diff --git a/ext/phar/tests/files/notbogus.zip b/ext/phar/tests/files/notbogus.zip new file mode 100644 index 0000000000..19ea96f874 Binary files /dev/null and b/ext/phar/tests/files/notbogus.zip differ diff --git a/ext/phar/tests/open_for_write_existing_b.phpt b/ext/phar/tests/open_for_write_existing_b.phpt index 6c3cd3e986..f0474372ae 100755 --- a/ext/phar/tests/open_for_write_existing_b.phpt +++ b/ext/phar/tests/open_for_write_existing_b.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (existing file) --SKIPIF-- - + --INI-- phar.readonly=1 phar.require_hash=0 @@ -35,8 +38,8 @@ include $pname . '/b/c.php'; Warning: fopen(phar://%sopen_for_write_existing_b.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %sopen_for_write_existing_b.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %sopen_for_write_existing_b.php on line %d This is b/c -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/phar/tests/open_for_write_existing_b_5_2.phpt b/ext/phar/tests/open_for_write_existing_b_5_2.phpt new file mode 100644 index 0000000000..0c694bed56 --- /dev/null +++ b/ext/phar/tests/open_for_write_existing_b_5_2.phpt @@ -0,0 +1,43 @@ +--TEST-- +Phar: fopen a .phar for writing (existing file) +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=1 +phar.require_hash=0 +--FILE-- +"; + +$files = array(); +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; +include 'files/phar_test.inc'; + +function err_handler($errno, $errstr, $errfile, $errline) { + echo "Catchable fatal error: $errstr in $errfile on line $errline\n"; +} + +set_error_handler("err_handler", E_RECOVERABLE_ERROR); + +$fp = fopen($pname . '/b/c.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); +include $pname . '/b/c.php'; +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_existing_b.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d +This is b/c +===DONE=== \ No newline at end of file diff --git a/ext/phar/tests/open_for_write_existing_c.phpt b/ext/phar/tests/open_for_write_existing_c.phpt index 9bbaaae92a..3f1d76bacd 100755 --- a/ext/phar/tests/open_for_write_existing_c.phpt +++ b/ext/phar/tests/open_for_write_existing_c.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (existing file) --SKIPIF-- - + --INI-- phar.readonly=1 phar.require_hash=0 @@ -29,8 +32,8 @@ include $pname . '/b/c.php'; Warning: fopen(phar://%sopen_for_write_existing_c.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_c.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_c.php on line %d This is b/c -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/phar/tests/open_for_write_existing_c_5_2.phpt b/ext/phar/tests/open_for_write_existing_c_5_2.phpt new file mode 100644 index 0000000000..de5855eb7e --- /dev/null +++ b/ext/phar/tests/open_for_write_existing_c_5_2.phpt @@ -0,0 +1,37 @@ +--TEST-- +Phar: fopen a .phar for writing (existing file) +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=1 +phar.require_hash=0 +--FILE-- +"; + +$files = array(); +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; +include 'files/phar_test.inc'; + +$fp = fopen($pname . '/b/c.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); +include $pname . '/b/c.php'; +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_existing_c.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d +This is b/c +===DONE=== \ No newline at end of file diff --git a/ext/phar/tests/open_for_write_newfile_b.phpt b/ext/phar/tests/open_for_write_newfile_b.phpt index 1c136ff1d5..9cfeeccec5 100755 --- a/ext/phar/tests/open_for_write_newfile_b.phpt +++ b/ext/phar/tests/open_for_write_newfile_b.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (new file) --SKIPIF-- - + --INI-- phar.readonly=1 phar.require_hash=0 @@ -37,9 +40,9 @@ include $pname . '/b/new.php'; Warning: fopen(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_b.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line 20 +Warning: fclose() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_b.php on line %d This is b/c Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line 22 diff --git a/ext/phar/tests/open_for_write_newfile_b_5_2.phpt b/ext/phar/tests/open_for_write_newfile_b_5_2.phpt new file mode 100644 index 0000000000..c0f92ecaab --- /dev/null +++ b/ext/phar/tests/open_for_write_newfile_b_5_2.phpt @@ -0,0 +1,50 @@ +--TEST-- +Phar: fopen a .phar for writing (new file) +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=1 +phar.require_hash=0 +--FILE-- +"; + +$files = array(); +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; +include 'files/phar_test.inc'; + +function err_handler($errno, $errstr, $errfile, $errline) { + echo "Catchable fatal error: $errstr in $errfile on line $errline\n"; +} + +set_error_handler("err_handler", E_RECOVERABLE_ERROR); + +$fp = fopen($pname . '/b/new.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); +include $pname . '/b/c.php'; +include $pname . '/b/new.php'; +?> + +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d +This is b/c + +Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line %d + +Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d + +===DONE=== diff --git a/ext/phar/tests/open_for_write_newfile_c.phpt b/ext/phar/tests/open_for_write_newfile_c.phpt index 59b4339eb9..fc509a5a5c 100755 --- a/ext/phar/tests/open_for_write_newfile_c.phpt +++ b/ext/phar/tests/open_for_write_newfile_c.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (new file) --SKIPIF-- - + --INI-- phar.readonly=1 phar.require_hash=0 @@ -31,9 +34,9 @@ include $pname . '/b/new.php'; Warning: fopen(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_c.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_c.php on line %d This is b/c Warning: include(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.php" in %sopen_for_write_newfile_c.php on line %d diff --git a/ext/phar/tests/open_for_write_newfile_c_5_2.phpt b/ext/phar/tests/open_for_write_newfile_c_5_2.phpt new file mode 100644 index 0000000000..6602397275 --- /dev/null +++ b/ext/phar/tests/open_for_write_newfile_c_5_2.phpt @@ -0,0 +1,44 @@ +--TEST-- +Phar: fopen a .phar for writing (new file) +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=1 +phar.require_hash=0 +--FILE-- +"; + +$files = array(); +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; +include 'files/phar_test.inc'; + +$fp = fopen($pname . '/b/new.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); +include $pname . '/b/c.php'; +include $pname . '/b/new.php'; +?> + +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d +This is b/c + +Warning: include(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.php" in %sopen_for_write_newfile_c.php on line %d + +Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d + +===DONE=== \ No newline at end of file diff --git a/ext/phar/tests/phar_extract3.phpt b/ext/phar/tests/phar_extract3.phpt new file mode 100644 index 0000000000..df85211a23 --- /dev/null +++ b/ext/phar/tests/phar_extract3.phpt @@ -0,0 +1,46 @@ +--TEST-- +Phar: Phar::extractTo() - check that phar exists +--SKIPIF-- + +--INI-- +phar.readonly=0 +--FILE-- +extractTo($extract); +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} + +$phar = new PharData($fname2); +foreach ($phar as $filename) { + echo "$filename\n"; +} + +try { + $phar->extractTo($extract); +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} + +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +Invalid argument, %sfiles/bogus.zip cannot be found +phar://%sfiles/notbogus.zip%cnonsense.txt +phar://%sfiles/notbogus.zip%cstuff.txt +===DONE=== diff --git a/ext/phar/tests/tar/open_for_write_existing_b.phpt b/ext/phar/tests/tar/open_for_write_existing_b.phpt index 54ec5855fb..c8bba1e350 100755 --- a/ext/phar/tests/tar/open_for_write_existing_b.phpt +++ b/ext/phar/tests/tar/open_for_write_existing_b.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (existing file) tar-based --SKIPIF-- - + --INI-- phar.readonly=0 phar.require_hash=0 @@ -48,9 +51,9 @@ include $alias . '/b/c.php'; Warning: fopen(phar://%sopen_for_write_existing_b.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_b.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %sopen_for_write_existing_b.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %sopen_for_write_existing_b.php on line %d This is b/c ===DONE=== diff --git a/ext/phar/tests/tar/open_for_write_existing_b_5_2.phpt b/ext/phar/tests/tar/open_for_write_existing_b_5_2.phpt new file mode 100644 index 0000000000..5b70192626 --- /dev/null +++ b/ext/phar/tests/tar/open_for_write_existing_b_5_2.phpt @@ -0,0 +1,57 @@ +--TEST-- +Phar: fopen a .phar for writing (existing file) tar-based +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=0 +phar.require_hash=0 +--FILE-- +setStub(""); + +$files = array(); + +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; + +foreach ($files as $n => $file) { + $phar[$n] = $file; +} + +$phar->stopBuffering(); +ini_set('phar.readonly', 1); + +function err_handler($errno, $errstr, $errfile, $errline) { + echo "Catchable fatal error: $errstr in $errfile on line $errline\n"; +} + +set_error_handler("err_handler", E_RECOVERABLE_ERROR); + +$fp = fopen($alias . '/b/c.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); + +include $alias . '/b/c.php'; + +?> + +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_existing_b.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_b.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d +This is b/c + +===DONE=== diff --git a/ext/phar/tests/tar/open_for_write_existing_c.phpt b/ext/phar/tests/tar/open_for_write_existing_c.phpt index 0e5a181e65..9295580885 100755 --- a/ext/phar/tests/tar/open_for_write_existing_c.phpt +++ b/ext/phar/tests/tar/open_for_write_existing_c.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (existing file) tar-based --SKIPIF-- - + --INI-- phar.readonly=0 phar.require_hash=0 @@ -42,9 +45,9 @@ include $alias . '/b/c.php'; Warning: fopen(phar://%sopen_for_write_existing_c.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_c.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_c.php on line %d This is b/c ===DONE=== diff --git a/ext/phar/tests/tar/open_for_write_existing_c_5_2.phpt b/ext/phar/tests/tar/open_for_write_existing_c_5_2.phpt new file mode 100644 index 0000000000..f56e77bef7 --- /dev/null +++ b/ext/phar/tests/tar/open_for_write_existing_c_5_2.phpt @@ -0,0 +1,51 @@ +--TEST-- +Phar: fopen a .phar for writing (existing file) tar-based +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=0 +phar.require_hash=0 +--FILE-- +setStub(""); + +$files = array(); + +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; + +foreach ($files as $n => $file) { + $phar[$n] = $file; +} + +$phar->stopBuffering(); +ini_set('phar.readonly', 1); + +$fp = fopen($alias . '/b/c.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); + +include $alias . '/b/c.php'; + +?> + +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_existing_c.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d +This is b/c + +===DONE=== diff --git a/ext/phar/tests/tar/open_for_write_newfile_b.phpt b/ext/phar/tests/tar/open_for_write_newfile_b.phpt index d3a21b4caf..f322ac27ad 100755 --- a/ext/phar/tests/tar/open_for_write_newfile_b.phpt +++ b/ext/phar/tests/tar/open_for_write_newfile_b.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (new file) tar-based --SKIPIF-- - + --INI-- phar.readonly=0 phar.require_hash=0 @@ -49,9 +52,9 @@ include $alias . '/b/new.php'; Warning: fopen(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_b.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_b.php on line %d This is b/c Warning: include(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.tar" in %sopen_for_write_newfile_b.php on line %d diff --git a/ext/phar/tests/tar/open_for_write_newfile_b_5_2.phpt b/ext/phar/tests/tar/open_for_write_newfile_b_5_2.phpt new file mode 100644 index 0000000000..831c2faaa5 --- /dev/null +++ b/ext/phar/tests/tar/open_for_write_newfile_b_5_2.phpt @@ -0,0 +1,62 @@ +--TEST-- +Phar: fopen a .phar for writing (new file) tar-based +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=0 +phar.require_hash=0 +--FILE-- +setStub(""); + +$files = array(); + +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; + +foreach ($files as $n => $file) { + $phar[$n] = $file; +} + +$phar->stopBuffering(); +ini_set('phar.readonly', 1); + +function err_handler($errno, $errstr, $errfile, $errline) { + echo "Catchable fatal error: $errstr in $errfile on line $errline\n"; +} + +set_error_handler("err_handler", E_RECOVERABLE_ERROR); + +$fp = fopen($alias . '/b/new.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); + +include $alias . '/b/c.php'; +include $alias . '/b/new.php'; + +?> + +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d +This is b/c + +Warning: include(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.tar" in %sopen_for_write_newfile_b.php on line %d + +Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.tar/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d + +===DONE=== diff --git a/ext/phar/tests/tar/open_for_write_newfile_c.phpt b/ext/phar/tests/tar/open_for_write_newfile_c.phpt index 231241c8ad..1925162015 100755 --- a/ext/phar/tests/tar/open_for_write_newfile_c.phpt +++ b/ext/phar/tests/tar/open_for_write_newfile_c.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (new file) tar-based --SKIPIF-- - + --INI-- phar.readonly=0 phar.require_hash=0 @@ -42,9 +45,9 @@ include $alias . '/b/new.php'; Warning: fopen(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_c.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_c.php on line %d This is b/c Warning: include(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.tar" in %sopen_for_write_newfile_c.php on line %d diff --git a/ext/phar/tests/tar/open_for_write_newfile_c_5_2.phpt b/ext/phar/tests/tar/open_for_write_newfile_c_5_2.phpt new file mode 100644 index 0000000000..eb77ea7cd9 --- /dev/null +++ b/ext/phar/tests/tar/open_for_write_newfile_c_5_2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Phar: fopen a .phar for writing (new file) tar-based +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=0 +phar.require_hash=0 +--FILE-- +setStub(""); + +$files = array(); + +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; + +foreach ($files as $n => $file) { + $phar[$n] = $file; +} + +$phar->stopBuffering(); +ini_set('phar.readonly', 1); + +$fp = fopen($alias . '/b/new.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); +include $alias . '/b/c.php'; +include $alias . '/b/new.php'; + +?> + +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d +This is b/c + +Warning: include(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.tar" in %sopen_for_write_newfile_c.php on line %d + +Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.tar/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d + +===DONE=== \ No newline at end of file diff --git a/ext/phar/tests/zip/open_for_write_existing_b.phpt b/ext/phar/tests/zip/open_for_write_existing_b.phpt index 347a1ce719..b339113650 100755 --- a/ext/phar/tests/zip/open_for_write_existing_b.phpt +++ b/ext/phar/tests/zip/open_for_write_existing_b.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (existing file) zip-based --SKIPIF-- - + --INI-- phar.readonly=0 phar.require_hash=0 @@ -45,8 +48,8 @@ include $alias . '/b/c.php'; Warning: fopen(phar://%sopen_for_write_existing_b.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_b.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_b.php on line %d This is b/c -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_existing_b_5_2.phpt b/ext/phar/tests/zip/open_for_write_existing_b_5_2.phpt new file mode 100644 index 0000000000..b6842eaf41 --- /dev/null +++ b/ext/phar/tests/zip/open_for_write_existing_b_5_2.phpt @@ -0,0 +1,53 @@ +--TEST-- +Phar: fopen a .phar for writing (existing file) zip-based +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=0 +phar.require_hash=0 +--FILE-- +setStub(''); + +$files = array(); + +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; + +foreach ($files as $n => $file) { + $phar[$n] = $file; +} +$phar->stopBuffering(); + +ini_set('phar.readonly', 1); + +function err_handler($errno, $errstr, $errfile, $errline) { + echo "Catchable fatal error: $errstr in $errfile on line $errline\n"; +} + +set_error_handler("err_handler", E_RECOVERABLE_ERROR); + +$fp = fopen($alias . '/b/c.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); +include $alias . '/b/c.php'; +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_existing_b.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d +This is b/c +===DONE=== \ No newline at end of file diff --git a/ext/phar/tests/zip/open_for_write_existing_c.phpt b/ext/phar/tests/zip/open_for_write_existing_c.phpt index b66a77b212..d39a7dd818 100755 --- a/ext/phar/tests/zip/open_for_write_existing_c.phpt +++ b/ext/phar/tests/zip/open_for_write_existing_c.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (existing file) zip-based --SKIPIF-- - + --INI-- phar.readonly=0 phar.require_hash=0 @@ -39,8 +42,8 @@ include $alias . '/b/c.php'; Warning: fopen(phar://%sopen_for_write_existing_c.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_c.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %spen_for_write_existing_c.php on line %d This is b/c -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_existing_c_5_2.phpt b/ext/phar/tests/zip/open_for_write_existing_c_5_2.phpt new file mode 100644 index 0000000000..de89ca06c1 --- /dev/null +++ b/ext/phar/tests/zip/open_for_write_existing_c_5_2.phpt @@ -0,0 +1,47 @@ +--TEST-- +Phar: fopen a .phar for writing (existing file) zip-based +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=0 +phar.require_hash=0 +--FILE-- +setStub(''); + +$files = array(); + +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; + +foreach ($files as $n => $file) { + $phar[$n] = $file; +} +$phar->stopBuffering(); + +ini_set('phar.readonly', 1); + +$fp = fopen($alias . '/b/c.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); +include $alias . '/b/c.php'; +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_existing_c.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d +This is b/c +===DONE=== \ No newline at end of file diff --git a/ext/phar/tests/zip/open_for_write_newfile_b.phpt b/ext/phar/tests/zip/open_for_write_newfile_b.phpt index 44ad7487fa..59b00ce6bb 100755 --- a/ext/phar/tests/zip/open_for_write_newfile_b.phpt +++ b/ext/phar/tests/zip/open_for_write_newfile_b.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (new file) zip-based --SKIPIF-- - + --INI-- phar.readonly=0 phar.require_hash=0 @@ -48,9 +51,9 @@ include $alias . '/b/new.php'; Warning: fopen(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_b.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_b.php on line %d This is b/c Warning: include(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.zip" in %sopen_for_write_newfile_b.php on line %d diff --git a/ext/phar/tests/zip/open_for_write_newfile_b_5_2.phpt b/ext/phar/tests/zip/open_for_write_newfile_b_5_2.phpt new file mode 100644 index 0000000000..585496c816 --- /dev/null +++ b/ext/phar/tests/zip/open_for_write_newfile_b_5_2.phpt @@ -0,0 +1,61 @@ +--TEST-- +Phar: fopen a .phar for writing (new file) zip-based +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=0 +phar.require_hash=0 +--FILE-- +setStub(''); + +$files = array(); + +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; + +foreach ($files as $n => $file) { + $phar[$n] = $file; +} +$phar->stopBuffering(); + +ini_set('phar.readonly', 1); + +function err_handler($errno, $errstr, $errfile, $errline) { + echo "Catchable fatal error: $errstr in $errfile on line $errline\n"; +} + +set_error_handler("err_handler", E_RECOVERABLE_ERROR); + +$fp = fopen($alias . '/b/new.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); + +include $alias . '/b/c.php'; +include $alias . '/b/new.php'; +?> + +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d +This is b/c + +Warning: include(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.zip" in %sopen_for_write_newfile_b.php on line %d + +Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.zip/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d + +===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_newfile_c.phpt b/ext/phar/tests/zip/open_for_write_newfile_c.phpt index b664397a99..7d16142e68 100755 --- a/ext/phar/tests/zip/open_for_write_newfile_c.phpt +++ b/ext/phar/tests/zip/open_for_write_newfile_c.phpt @@ -1,7 +1,10 @@ --TEST-- Phar: fopen a .phar for writing (new file) zip-based --SKIPIF-- - + --INI-- phar.readonly=0 phar.require_hash=0 @@ -42,9 +45,9 @@ include $alias . '/b/new.php'; Warning: fopen(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c.php on line %d -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d +Warning: fwrite() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_c.php on line %d -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d +Warning: fclose() expects parameter 1 to be resource, boolean given in %sopen_for_write_newfile_c.php on line %d This is b/c Warning: include(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.zip" in %sopen_for_write_newfile_c.php on line %d diff --git a/ext/phar/tests/zip/open_for_write_newfile_c_5_2.phpt b/ext/phar/tests/zip/open_for_write_newfile_c_5_2.phpt new file mode 100644 index 0000000000..c79df7c2ac --- /dev/null +++ b/ext/phar/tests/zip/open_for_write_newfile_c_5_2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Phar: fopen a .phar for writing (new file) zip-based +--SKIPIF-- + +")) die("skip requires 5.2 or earlier"); ?> +--INI-- +phar.readonly=0 +phar.require_hash=0 +--FILE-- +setStub(''); + +$files = array(); + +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; + +foreach ($files as $n => $file) { + $phar[$n] = $file; +} +$phar->stopBuffering(); + +ini_set('phar.readonly', 1); + +$fp = fopen($alias . '/b/new.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); + +include $alias . '/b/c.php'; +include $alias . '/b/new.php'; +?> + +===DONE=== +--CLEAN-- + +--EXPECTF-- + +Warning: fopen(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c.php on line %d + +Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d +This is b/c + +Warning: include(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.zip" in %sopen_for_write_newfile_c.php on line %d + +Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.zip/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d + +===DONE=== \ No newline at end of file