Annotation of embedaddon/php/ext/ereg/tests/spliti_variation_002.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test spliti() function : usage variations  - unexpected type for arg 2
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : proto array spliti(string pattern, string string [, int limit])
                      6:  * Description: spliti string into array by regular expression 
                      7:  * Source code: ext/standard/reg.c
                      8:  * Alias to functions: 
                      9:  */
                     10: 
                     11: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
                     12:        echo "Error: $err_no - $err_msg, $filename($linenum)\n";
                     13: }
                     14: set_error_handler('test_error_handler');
                     15: 
                     16: echo "*** Testing spliti() : usage variations ***\n";
                     17: 
                     18: // Initialise function arguments not being substituted (if any)
                     19: $pattern = 'r|j|E';
                     20: $limit = 5;
                     21: 
                     22: //get an unset variable
                     23: $unset_var = 10;
                     24: unset ($unset_var);
                     25: 
                     26: //array of values to iterate over
                     27: $values = array(
                     28: 
                     29:       // int data
                     30:       0,
                     31:       1,
                     32:       12345,
                     33:       -2345,
                     34: 
                     35:       // float data
                     36:       10.5,
                     37:       -10.5,
                     38:       10.1234567e10,
                     39:       10.7654321E-10,
                     40:       .5,
                     41: 
                     42:       // array data
                     43:       array(),
                     44:       array(0),
                     45:       array(1),
                     46:       array(1, 2),
                     47:       array('color' => 'red', 'item' => 'pen'),
                     48: 
                     49:       // null data
                     50:       NULL,
                     51:       null,
                     52: 
                     53:       // boolean data
                     54:       true,
                     55:       false,
                     56:       TRUE,
                     57:       FALSE,
                     58: 
                     59:       // empty data
                     60:       "",
                     61:       '',
                     62: 
                     63:       // object data
                     64:       new stdclass(),
                     65: 
                     66:       // undefined data
                     67:       $undefined_var,
                     68: 
                     69:       // unset data
                     70:       $unset_var,
                     71: );
                     72: 
                     73: // loop through each element of the array for string
                     74: 
                     75: foreach($values as $value) {
                     76:       echo "\nArg value $value \n";
                     77:       var_dump( spliti($pattern, $value, $limit) );
                     78: };
                     79: 
                     80: echo "Done";
                     81: ?>
                     82: --EXPECTF--
                     83: *** Testing spliti() : usage variations ***
                     84: Error: 8 - Undefined variable: undefined_var, %s(64)
                     85: Error: 8 - Undefined variable: unset_var, %s(67)
                     86: 
                     87: Arg value 0 
                     88: Error: 8192 - Function spliti() is deprecated, %s(74)
                     89: array(1) {
                     90:   [0]=>
                     91:   string(1) "0"
                     92: }
                     93: 
                     94: Arg value 1 
                     95: Error: 8192 - Function spliti() is deprecated, %s(74)
                     96: array(1) {
                     97:   [0]=>
                     98:   string(1) "1"
                     99: }
                    100: 
                    101: Arg value 12345 
                    102: Error: 8192 - Function spliti() is deprecated, %s(74)
                    103: array(1) {
                    104:   [0]=>
                    105:   string(5) "12345"
                    106: }
                    107: 
                    108: Arg value -2345 
                    109: Error: 8192 - Function spliti() is deprecated, %s(74)
                    110: array(1) {
                    111:   [0]=>
                    112:   string(5) "-2345"
                    113: }
                    114: 
                    115: Arg value 10.5 
                    116: Error: 8192 - Function spliti() is deprecated, %s(74)
                    117: array(1) {
                    118:   [0]=>
                    119:   string(4) "10.5"
                    120: }
                    121: 
                    122: Arg value -10.5 
                    123: Error: 8192 - Function spliti() is deprecated, %s(74)
                    124: array(1) {
                    125:   [0]=>
                    126:   string(5) "-10.5"
                    127: }
                    128: 
                    129: Arg value 101234567000 
                    130: Error: 8192 - Function spliti() is deprecated, %s(74)
                    131: array(1) {
                    132:   [0]=>
                    133:   string(12) "101234567000"
                    134: }
                    135: 
                    136: Arg value 1.07654321E-9 
                    137: Error: 8192 - Function spliti() is deprecated, %s(74)
                    138: array(2) {
                    139:   [0]=>
                    140:   string(10) "1.07654321"
                    141:   [1]=>
                    142:   string(2) "-9"
                    143: }
                    144: 
                    145: Arg value 0.5 
                    146: Error: 8192 - Function spliti() is deprecated, %s(74)
                    147: array(1) {
                    148:   [0]=>
                    149:   string(3) "0.5"
                    150: }
1.1.1.2 ! misho     151: Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
1.1       misho     152: 
                    153: Arg value Array 
                    154: Error: 8192 - Function spliti() is deprecated, %s(74)
                    155: Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
                    156: NULL
1.1.1.2 ! misho     157: Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
1.1       misho     158: 
                    159: Arg value Array 
                    160: Error: 8192 - Function spliti() is deprecated, %s(74)
                    161: Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
                    162: NULL
1.1.1.2 ! misho     163: Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
1.1       misho     164: 
                    165: Arg value Array 
                    166: Error: 8192 - Function spliti() is deprecated, %s(74)
                    167: Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
                    168: NULL
1.1.1.2 ! misho     169: Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
1.1       misho     170: 
                    171: Arg value Array 
                    172: Error: 8192 - Function spliti() is deprecated, %s(74)
                    173: Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
                    174: NULL
1.1.1.2 ! misho     175: Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
1.1       misho     176: 
                    177: Arg value Array 
                    178: Error: 8192 - Function spliti() is deprecated, %s(74)
                    179: Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
                    180: NULL
                    181: 
                    182: Arg value  
                    183: Error: 8192 - Function spliti() is deprecated, %s(74)
                    184: array(1) {
                    185:   [0]=>
                    186:   string(0) ""
                    187: }
                    188: 
                    189: Arg value  
                    190: Error: 8192 - Function spliti() is deprecated, %s(74)
                    191: array(1) {
                    192:   [0]=>
                    193:   string(0) ""
                    194: }
                    195: 
                    196: Arg value 1 
                    197: Error: 8192 - Function spliti() is deprecated, %s(74)
                    198: array(1) {
                    199:   [0]=>
                    200:   string(1) "1"
                    201: }
                    202: 
                    203: Arg value  
                    204: Error: 8192 - Function spliti() is deprecated, %s(74)
                    205: array(1) {
                    206:   [0]=>
                    207:   string(0) ""
                    208: }
                    209: 
                    210: Arg value 1 
                    211: Error: 8192 - Function spliti() is deprecated, %s(74)
                    212: array(1) {
                    213:   [0]=>
                    214:   string(1) "1"
                    215: }
                    216: 
                    217: Arg value  
                    218: Error: 8192 - Function spliti() is deprecated, %s(74)
                    219: array(1) {
                    220:   [0]=>
                    221:   string(0) ""
                    222: }
                    223: 
                    224: Arg value  
                    225: Error: 8192 - Function spliti() is deprecated, %s(74)
                    226: array(1) {
                    227:   [0]=>
                    228:   string(0) ""
                    229: }
                    230: 
                    231: Arg value  
                    232: Error: 8192 - Function spliti() is deprecated, %s(74)
                    233: array(1) {
                    234:   [0]=>
                    235:   string(0) ""
                    236: }
                    237: Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
                    238: 
                    239: Arg value  
                    240: Error: 8192 - Function spliti() is deprecated, %s(74)
                    241: Error: 2 - spliti() expects parameter 2 to be string, object given, %s(74)
                    242: NULL
                    243: 
                    244: Arg value  
                    245: Error: 8192 - Function spliti() is deprecated, %s(74)
                    246: array(1) {
                    247:   [0]=>
                    248:   string(0) ""
                    249: }
                    250: 
                    251: Arg value  
                    252: Error: 8192 - Function spliti() is deprecated, %s(74)
                    253: array(1) {
                    254:   [0]=>
                    255:   string(0) ""
                    256: }
                    257: Done

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