Annotation of embedaddon/php/ext/posix/tests/posix_mkfifo_safemode.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test posix_mkfifo() with safe_mode.
                      3: --DESCRIPTION--
                      4: The test attempts to enable safe_mode, catches all the relevant E_WARNING's and tries to create a fifo in /tmp.
                      5: 
                      6: The first attempt (writing to /tmp) should effectively fail because /tmp is owned by root.
                      7: 
                      8: The second attempt (writing to a local created file) works.
                      9: --CREDITS--
                     10: Till Klampaeckel, till@php.net
                     11: TestFest Berlin 2009
                     12: --SKIPIF--
                     13: <?php
                     14: if (!extension_loaded('posix')) {
                     15:     die('SKIP The posix extension is not loaded.');
                     16: }
                     17: if (posix_geteuid() == 0) {
                     18:     die('SKIP Cannot run test as root.');
                     19: }
1.1.1.2 ! misho      20: if (PHP_VERSION_ID < 503099) {
        !            21:     die('SKIP Safe mode is no longer available.');
        !            22: }
1.1       misho      23: ?>
                     24: --FILE--
                     25: <?php
                     26: var_dump(posix_mkfifo('/tmp/foobar', 0644));
                     27: 
                     28: $dir = dirname(__FILE__) . '/foo';
                     29: mkdir ($dir);
                     30: var_dump(posix_mkfifo($dir . '/bar', 0644));
                     31: ?>
                     32: ===DONE===
                     33: --CLEAN--
                     34: <?php
                     35: $dir = dirname(__FILE__) . '/foo';
                     36: unlink($dir . '/bar');
                     37: rmdir($dir);
                     38: ?>
                     39: --EXPECTF--
                     40: Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in %s on line %d
                     41: 
                     42: Warning: posix_mkfifo(): SAFE MODE Restriction in effect.  The script whose uid is %d is not allowed to access /tmp owned by uid %d in %s on line %d
                     43: bool(false)
                     44: bool(true)
                     45: ===DONE===

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