Annotation of embedaddon/php/ext/phar/tests/fgc_edgecases.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Phar: test edge cases of file_get_contents() function interception
                      3: --SKIPIF--
                      4: <?php
                      5: if (!extension_loaded("phar")) die("skip");
                      6: if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
                      7: ?>
                      8: --INI--
                      9: phar.readonly=0
                     10: --FILE--
                     11: <?php
                     12: 
                     13: Phar::interceptFileFuncs();
                     14: 
                     15: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
                     16: $pname = 'phar://' . $fname;
                     17: 
                     18: file_get_contents(array());
                     19: chdir(dirname(__FILE__));
                     20: file_put_contents($fname, "blah\n");
                     21: file_put_contents("foob", "test\n");
                     22: echo file_get_contents($fname);
                     23: unlink($fname);
                     24: mkdir($pname . '/oops');
                     25: 
                     26: file_put_contents($pname . '/foo/hi', '<?php
                     27: echo file_get_contents("foo/" . basename(__FILE__));
                     28: $context = stream_context_create();
                     29: file_get_contents("./hi", 0, $context, 0, -1);
                     30: echo file_get_contents("foob");
                     31: set_include_path("' . addslashes(dirname(__FILE__)) . '");
                     32: echo file_get_contents("foob", true);
                     33: echo file_get_contents("./hi", 0, $context);
                     34: echo file_get_contents("../oops");
                     35: echo file_get_contents("./hi", 0, $context, 50000);
                     36: echo file_get_contents("./hi");
                     37: echo file_get_contents("./hi", 0, $context, 0, 0);
                     38: ?>
                     39: ');
                     40: 
                     41: include $pname . '/foo/hi';
                     42: 
                     43: ?>
                     44: ===DONE===
                     45: --CLEAN--
                     46: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
                     47: <?php rmdir(dirname(__FILE__) . '/poo'); ?>
                     48: <?php unlink(dirname(__FILE__) . '/foob'); ?>
                     49: --EXPECTF--
1.1.1.2 ! misho      50: Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %sfgc_edgecases.php on line %d
1.1       misho      51: blah
                     52: <?php
                     53: echo file_get_contents("foo/" . basename(__FILE__));
                     54: $context = stream_context_create();
                     55: file_get_contents("./hi", 0, $context, 0, -1);
                     56: echo file_get_contents("foob");
                     57: set_include_path("%stests");
                     58: echo file_get_contents("foob", true);
                     59: echo file_get_contents("./hi", 0, $context);
                     60: echo file_get_contents("../oops");
                     61: echo file_get_contents("./hi", 0, $context, 50000);
                     62: echo file_get_contents("./hi");
                     63: echo file_get_contents("./hi", 0, $context, 0, 0);
                     64: ?>
                     65: 
                     66: Warning: file_get_contents(): length must be greater than or equal to zero in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
                     67: test
                     68: test
                     69: <?php
                     70: echo file_get_contents("foo/" . basename(__FILE__));
                     71: $context = stream_context_create();
                     72: file_get_contents("./hi", 0, $context, 0, -1);
                     73: echo file_get_contents("foob");
                     74: set_include_path("%stests");
                     75: echo file_get_contents("foob", true);
                     76: echo file_get_contents("./hi", 0, $context);
                     77: echo file_get_contents("../oops");
                     78: echo file_get_contents("./hi", 0, $context, 50000);
                     79: echo file_get_contents("./hi");
                     80: echo file_get_contents("./hi", 0, $context, 0, 0);
                     81: ?>
                     82: 
                     83: Warning: file_get_contents(phar://%sfgc_edgecases.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
                     84: 
                     85: Warning: file_get_contents(): Failed to seek to position 50000 in the stream in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
                     86: <?php
1.1.1.2 ! misho      87: echo file_get_contents("foo/" . basename(__FILE__));
1.1       misho      88: $context = stream_context_create();
1.1.1.2 ! misho      89: file_get_contents("./hi", 0, $context, 0, -1);
        !            90: echo file_get_contents("foob");
        !            91: set_include_path("%stests");
        !            92: echo file_get_contents("foob", true);
        !            93: echo file_get_contents("./hi", 0, $context);
        !            94: echo file_get_contents("../oops");
        !            95: echo file_get_contents("./hi", 0, $context, 50000);
        !            96: echo file_get_contents("./hi");
        !            97: echo file_get_contents("./hi", 0, $context, 0, 0);
1.1       misho      98: ?>
                     99: ===DONE===

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