Annotation of embedaddon/php/ext/phar/tests/opendir_edgecases.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Phar: test edge cases of opendir() function interception
        !             3: --SKIPIF--
        !             4: <?php if (!extension_loaded("phar")) die("skip");?>
        !             5: --INI--
        !             6: phar.readonly=0
        !             7: --FILE--
        !             8: <?php
        !             9: 
        !            10: Phar::interceptFileFuncs();
        !            11: 
        !            12: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
        !            13: $pname = 'phar://' . $fname;
        !            14: 
        !            15: opendir(array());
        !            16: 
        !            17: mkdir(dirname(__FILE__) . '/poo');
        !            18: chdir(dirname(__FILE__));
        !            19: 
        !            20: $a = opendir('poo');
        !            21: 
        !            22: $arr = array();
        !            23: while (false !== ($b = readdir($a))) {
        !            24:     $arr[] = $b;
        !            25: }
        !            26: sort($arr);
        !            27: foreach ($arr as $b) {
        !            28:     echo "$b\n";
        !            29: }
        !            30: 
        !            31: closedir($a);
        !            32: 
        !            33: file_put_contents($pname . '/foo', '<?php
        !            34: $context = stream_context_create();
        !            35: $a = opendir(".", $context);
        !            36: $res = array();
        !            37: while (false !== ($b = readdir($a))) {
        !            38: $res[] = $b;
        !            39: }
        !            40: sort($res);
        !            41: foreach ($res as $b) {
        !            42: echo "$b\n";
        !            43: }
        !            44: opendir("oops");
        !            45: ?>');
        !            46: 
        !            47: include $pname . '/foo';
        !            48: 
        !            49: ?>
        !            50: ===DONE===
        !            51: --CLEAN--
        !            52: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
        !            53: <?php rmdir(dirname(__FILE__) . '/poo');
        !            54: --EXPECTF--
        !            55: Warning: opendir() expects parameter 1 to be %string, array given in %sopendir_edgecases.php on line %d
        !            56: .
        !            57: ..
        !            58: foo
        !            59: 
        !            60: Warning: opendir(phar://%sopendir_edgecases.phar.php/oops): failed to open dir: %s in phar://%sopendir_edgecases.phar.php/foo on line %d
        !            61: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>