Annotation of embedaddon/php/ext/zlib/tests/gzopen_variation9.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test gzopen() function : variation: try opening with possibly invalid modes
                      3: --SKIPIF--
                      4: <?php 
                      5: if (!extension_loaded("zlib")) {
                      6:        print "skip - ZLIB extension not loaded"; 
                      7: }       
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: /* Prototype  : resource gzopen(string filename, string mode [, int use_include_path])
                     12:  * Description: Open a .gz-file and return a .gz-file pointer 
                     13:  * Source code: ext/zlib/zlib.c
                     14:  * Alias to functions: 
                     15:  */
                     16: 
                     17: echo "*** Testing gzopen() : variation ***\n";
                     18: 
                     19: $modes = array('r+', 'rf', 'w+' , 'e');
                     20: 
                     21: $file = dirname(__FILE__)."/004.txt.gz";
                     22: 
                     23: foreach ($modes as $mode) {
                     24:     echo "mode=$mode\n";
                     25:     $h = gzopen($file, $mode);
                     26:     echo "gzopen=";
                     27:     var_dump($h);
                     28:     if ($h !== false) {
                     29:        gzclose($h);
                     30:     }
                     31:     echo "\n";
                     32: }
                     33: ?>
                     34: ===DONE===
                     35: --EXPECTF--
                     36: *** Testing gzopen() : variation ***
                     37: mode=r+
                     38: 
                     39: Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
                     40: gzopen=bool(false)
                     41: 
                     42: mode=rf
                     43: gzopen=resource(%d) of type (stream)
                     44: 
                     45: mode=w+
                     46: 
                     47: Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
                     48: gzopen=bool(false)
                     49: 
                     50: mode=e
                     51: 
                     52: Warning: gzopen(%s/004.txt.gz): failed to open stream: %s in %s on line %d
                     53: gzopen=bool(false)
                     54: 
                     55: ===DONE===

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