Annotation of embedaddon/php/ext/standard/tests/file/popen_pclose_error-win32-debug.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test popen() and pclose function: error conditions
                      3: 
                      4: --SKIPIF--
                      5: <?php
                      6: if(substr(PHP_OS, 0, 3) != 'WIN' && PHP_DEBUG) die("skip Valid only on Windows");
                      7: if(!PHP_DEBUG) die("skip Not Valid for release builds");
                      8: 
                      9: ob_start();phpinfo(INFO_GENERAL);$inf=ob_get_contents(); ob_end_clean();
                     10: if (!(strpos($inf, 'MSVC9') || strpos($inf, 'MSVC8'))) die("skip Not Valid for build done with VC < 8");
                     11: ?>
                     12: 
                     13: --FILE--
                     14: <?php
                     15: /*
                     16:  * Prototype: resource popen ( string command, string mode )
                     17:  * Description: Opens process file pointer.
                     18: 
                     19:  * Prototype: int pclose ( resource handle );
                     20:  * Description: Closes process file pointer.
                     21:  */
                     22: $file_path = dirname(__FILE__);
                     23: echo "*** Testing for error conditions ***\n";
                     24: var_dump( popen() );  // Zero Arguments
                     25: var_dump( popen("abc.txt") );   // Single Argument
                     26: var_dump( popen("abc.txt", "rw") );   // Invalid mode Argument
                     27: var_dump( pclose() );
                     28: $file_handle = fopen($file_path."/popen.tmp", "w");
                     29: var_dump( pclose($file_handle, $file_handle) );
                     30: pclose($file_handle);
                     31: var_dump( pclose(1) );
                     32: echo "\n--- Done ---";
                     33: ?>
                     34: --CLEAN--
                     35: <?php
                     36: $file_path = dirname(__FILE__);
                     37: unlink($file_path."/popen.tmp");
                     38: ?>
                     39: --EXPECTF--
                     40: *** Testing for error conditions ***
                     41: 
                     42: Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d
                     43: NULL
                     44: 
                     45: Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d
                     46: NULL
                     47: 
                     48: Warning: Invalid parameter detected in CRT function '_fdopen' (%s:%d) in %s on line %d
                     49: 
                     50: Warning: popen(abc.txt,rw): Invalid argument in %s on line %d
                     51: bool(false)
                     52: 
                     53: Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d
                     54: bool(false)
                     55: 
                     56: Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d
                     57: bool(false)
                     58: 
                     59: Warning: pclose() expects parameter 1 to be resource, integer given in %s on line %d
                     60: bool(false)
                     61: 
                     62: --- Done ---'abc.txt' is not recognized as an internal or external command,
                     63: operable program or batch file.

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