Annotation of embedaddon/php/ext/phar/tests/fopen_edgecases2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar: test edge cases of fopen() function interception #2
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: <?php if (version_compare(phpversion(), '6.0', '>=')) die('skip parameter parsing changed in 6.0'); ?>
! 6: --INI--
! 7: phar.readonly=0
! 8: --FILE--
! 9: <?php
! 10: Phar::interceptFileFuncs();
! 11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
! 12: $pname = 'phar://' . $fname;
! 13:
! 14: fopen(array(), 'r');
! 15: chdir(dirname(__FILE__));
! 16: file_put_contents($fname, b"blah\n");
! 17: file_put_contents("foob", b"test\n");
! 18: $a = fopen($fname, 'rb');
! 19: echo fread($a, 1000);
! 20: fclose($a);
! 21: unlink($fname);
! 22: mkdir($pname . '/oops');
! 23: file_put_contents($pname . '/foo/hi', b'<?php
! 24: $context = stream_context_create();
! 25: $a = fopen("foob", "rb", false, $context);
! 26: echo fread($a, 1000);
! 27: fclose($a);
! 28: fopen("../oops", "r");
! 29: ?>
! 30: ');
! 31: include $pname . '/foo/hi';
! 32: ?>
! 33: ===DONE===
! 34: --CLEAN--
! 35: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
! 36: <?php rmdir(dirname(__FILE__) . '/poo'); ?>
! 37: <?php unlink(dirname(__FILE__) . '/foob'); ?>
! 38: --EXPECTF--
! 39: Warning: fopen() expects parameter 1 to be string, array given in %sfopen_edgecases2.php on line %d
! 40: blah
! 41: test
! 42:
! 43: Warning: fopen(phar://%sfopen_edgecases2.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sfopen_edgecases2.phar.php/foo/hi on line %d
! 44: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>