Annotation of embedaddon/php/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test escapeshellarg() function : usage variations - different data types as $arg arg
                      3: --SKIPIF--
                      4: <?php
                      5: if( substr(PHP_OS, 0, 3) != "WIN" )
                      6:   die("skip.. only for Windows");
                      7: ?>
                      8: --FILE--
                      9: <?php
                     10: 
                     11: /* Prototype  : string escapeshellarg  ( string $arg  )
                     12:  * Description:  Escape a string to be used as a shell argument.
                     13:  * Source code: ext/standard/exec.c
                     14:  */
                     15: 
                     16: echo "*** Testing escapeshellarg() : usage variations ***\n";
                     17: 
                     18: //get an unset variable
                     19: $unset_var = 10;
                     20: unset ($unset_var);
                     21: 
                     22: // heredoc string
                     23: $heredoc = <<<EOT
                     24: abc
                     25: xyz
                     26: EOT;
                     27: 
                     28: 
                     29: // get a resource variable
                     30: $fp = fopen(__FILE__, "r");
                     31: 
                     32: $inputs = array(
                     33:        // int data
                     34: /*1*/  0,
                     35:        1,
                     36:        12,
                     37:        -12,       
                     38:        2147483647,
                     39: 
                     40:        // float data
                     41: /*6*/  10.5,
                     42:        -10.5,
                     43:        1.234567e2,
                     44:        1.234567E-2,
                     45:        .5,
                     46: 
                     47:        // null data
                     48: /*11*/ NULL,
                     49:        null,
                     50: 
                     51:        // boolean data
                     52: /*13*/ true,
                     53:        false,
                     54:        TRUE,
                     55:        FALSE,
                     56:        
                     57:        // empty data
                     58: /*17*/ "",
                     59:        '',
                     60: 
                     61:        // undefined data
                     62: /*19*/ @$undefined_var,
                     63: 
                     64:        // unset data
                     65: /*20*/ @$unset_var,
                     66: 
                     67: );
                     68: 
                     69: // loop through each element of $inputs to check the behaviour of escapeshellarg()
                     70: $iterator = 1;
                     71: foreach($inputs as $input) {
                     72:        echo "\n-- Iteration $iterator --\n";
                     73:        var_dump(escapeshellarg($input));
                     74:        $iterator++;
                     75: };
                     76: ?>
                     77: ===Done===
                     78: --EXPECT--
                     79: *** Testing escapeshellarg() : usage variations ***
                     80: 
                     81: -- Iteration 1 --
                     82: string(3) ""0""
                     83: 
                     84: -- Iteration 2 --
                     85: string(3) ""1""
                     86: 
                     87: -- Iteration 3 --
                     88: string(4) ""12""
                     89: 
                     90: -- Iteration 4 --
                     91: string(5) ""-12""
                     92: 
                     93: -- Iteration 5 --
                     94: string(12) ""2147483647""
                     95: 
                     96: -- Iteration 6 --
                     97: string(6) ""10.5""
                     98: 
                     99: -- Iteration 7 --
                    100: string(7) ""-10.5""
                    101: 
                    102: -- Iteration 8 --
                    103: string(10) ""123.4567""
                    104: 
                    105: -- Iteration 9 --
                    106: string(12) ""0.01234567""
                    107: 
                    108: -- Iteration 10 --
                    109: string(5) ""0.5""
                    110: 
                    111: -- Iteration 11 --
                    112: string(2) """"
                    113: 
                    114: -- Iteration 12 --
                    115: string(2) """"
                    116: 
                    117: -- Iteration 13 --
                    118: string(3) ""1""
                    119: 
                    120: -- Iteration 14 --
                    121: string(2) """"
                    122: 
                    123: -- Iteration 15 --
                    124: string(3) ""1""
                    125: 
                    126: -- Iteration 16 --
                    127: string(2) """"
                    128: 
                    129: -- Iteration 17 --
                    130: string(2) """"
                    131: 
                    132: -- Iteration 18 --
                    133: string(2) """"
                    134: 
                    135: -- Iteration 19 --
                    136: string(2) """"
                    137: 
                    138: -- Iteration 20 --
                    139: string(2) """"
                    140: ===Done===

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