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

1.1       misho       1: --TEST--
                      2: Test posix_strerror() function : usage variations
                      3: --SKIPIF--
                      4: <?php 
                      5:        if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; 
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: /* Prototype  : proto string posix_strerror(int errno)
                     10:  * Description: Retrieve the system error message associated with the given errno. 
                     11:  * Source code: ext/posix/posix.c
                     12:  * Alias to functions: 
                     13:  */
                     14: 
                     15: echo "*** Testing posix_strerror() : usage variations ***\n";
                     16: 
                     17: // Initialise function arguments not being substituted (if any)
                     18: 
                     19: //get an unset variable
                     20: $unset_var = 10;
                     21: unset ($unset_var);
                     22: 
                     23: //array of values to iterate over
                     24: $values = array(
                     25: 
                     26:       // float data
                     27:       10.5,
                     28:       -10.5,
                     29:       10.1234567e10,
                     30:       10.7654321E-10,
                     31:       .5,
                     32: 
                     33:       // array data
                     34:       array(),
                     35:       array(0),
                     36:       array(1),
                     37:       array(1, 2),
                     38:       array('color' => 'red', 'item' => 'pen'),
                     39: 
                     40:       // null data
                     41:       NULL,
                     42:       null,
                     43: 
                     44:       // boolean data
                     45:       true,
                     46:       false,
                     47:       TRUE,
                     48:       FALSE,
                     49: 
                     50:       // empty data
                     51:       "",
                     52:       '',
                     53: 
                     54:       // string data
                     55:       "string",
                     56:       'string',
                     57: 
                     58:       // undefined data
                     59:       $undefined_var,
                     60: 
                     61:       // unset data
                     62:       $unset_var,
                     63:       
                     64:       // object data
                     65:       new stdclass(),
                     66: );
                     67: 
                     68: // loop through each element of the array for errno
                     69: 
                     70: foreach($values as $value) {
                     71:       echo "\nArg value $value \n";
                     72:       echo gettype( posix_strerror($value) )."\n";
                     73: };
                     74: 
                     75: echo "Done";
                     76: ?>
                     77: --EXPECTF--
                     78: *** Testing posix_strerror() : usage variations ***
                     79: 
                     80: Notice: Undefined variable: undefined_var in %s on line %d
                     81: 
                     82: Notice: Undefined variable: unset_var in %s on line %d
                     83: 
                     84: Arg value 10.5 
                     85: string
                     86: 
                     87: Arg value -10.5 
                     88: string
                     89: 
                     90: Arg value 101234567000 
                     91: string
                     92: 
                     93: Arg value 1.07654321E-9 
                     94: string
                     95: 
                     96: Arg value 0.5 
                     97: string
                     98: 
1.1.1.2 ! misho      99: Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
        !           100: 
1.1       misho     101: Arg value Array 
                    102: 
                    103: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
                    104: boolean
                    105: 
1.1.1.2 ! misho     106: Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
        !           107: 
1.1       misho     108: Arg value Array 
                    109: 
                    110: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
                    111: boolean
                    112: 
1.1.1.2 ! misho     113: Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
        !           114: 
1.1       misho     115: Arg value Array 
                    116: 
                    117: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
                    118: boolean
                    119: 
1.1.1.2 ! misho     120: Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
        !           121: 
1.1       misho     122: Arg value Array 
                    123: 
                    124: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
                    125: boolean
                    126: 
1.1.1.2 ! misho     127: Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
        !           128: 
1.1       misho     129: Arg value Array 
                    130: 
                    131: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
                    132: boolean
                    133: 
                    134: Arg value  
                    135: string
                    136: 
                    137: Arg value  
                    138: string
                    139: 
                    140: Arg value 1 
                    141: string
                    142: 
                    143: Arg value  
                    144: string
                    145: 
                    146: Arg value 1 
                    147: string
                    148: 
                    149: Arg value  
                    150: string
                    151: 
                    152: Arg value  
                    153: 
                    154: Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
                    155: boolean
                    156: 
                    157: Arg value  
                    158: 
                    159: Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
                    160: boolean
                    161: 
                    162: Arg value string 
                    163: 
                    164: Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
                    165: boolean
                    166: 
                    167: Arg value string 
                    168: 
                    169: Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
                    170: boolean
                    171: 
                    172: Arg value  
                    173: string
                    174: 
                    175: Arg value  
                    176: string
                    177: 
                    178: Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d

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