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

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: }
        !            20: ?>
        !            21: --INI--
        !            22: safe_mode = 1
        !            23: --FILE--
        !            24: <?php
        !            25: var_dump(posix_mkfifo('/tmp/foobar', 0644));
        !            26: 
        !            27: $dir = dirname(__FILE__) . '/foo';
        !            28: mkdir ($dir);
        !            29: var_dump(posix_mkfifo($dir . '/bar', 0644));
        !            30: ?>
        !            31: ===DONE===
        !            32: --CLEAN--
        !            33: <?php
        !            34: $dir = dirname(__FILE__) . '/foo';
        !            35: unlink($dir . '/bar');
        !            36: rmdir($dir);
        !            37: ?>
        !            38: --EXPECTF--
        !            39: Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in %s on line %d
        !            40: 
        !            41: 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
        !            42: bool(false)
        !            43: bool(true)
        !            44: ===DONE===

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