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

1.1       misho       1: --TEST--
                      2: Test split() function : usage variations  - unexpected type for arg 1
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : proto array split(string pattern, string string [, int limit])
                      6:  * Description: Split 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 split() : usage variations ***\n";
                     17: 
                     18: // Initialise function arguments not being substituted (if any)
                     19: $string = '1 a 1 Array 1 c ';
                     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 pattern
                     74: 
                     75: foreach($values as $value) {
                     76:       echo "\nArg value $value \n";
                     77:       var_dump( split($value, $string, $limit) );
                     78: };
                     79: 
                     80: echo "Done";
                     81: ?>
                     82: --EXPECTF--
                     83: *** Testing split() : 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 split() is deprecated, %s(74)
                     89: array(1) {
                     90:   [0]=>
                     91:   string(16) "1 a 1 Array 1 c "
                     92: }
                     93: 
                     94: Arg value 1 
                     95: Error: 8192 - Function split() is deprecated, %s(74)
                     96: array(4) {
                     97:   [0]=>
                     98:   string(0) ""
                     99:   [1]=>
                    100:   string(3) " a "
                    101:   [2]=>
                    102:   string(7) " Array "
                    103:   [3]=>
                    104:   string(3) " c "
                    105: }
                    106: 
                    107: Arg value 12345 
                    108: Error: 8192 - Function split() is deprecated, %s(74)
                    109: array(1) {
                    110:   [0]=>
                    111:   string(16) "1 a 1 Array 1 c "
                    112: }
                    113: 
                    114: Arg value -2345 
                    115: Error: 8192 - Function split() is deprecated, %s(74)
                    116: array(1) {
                    117:   [0]=>
                    118:   string(16) "1 a 1 Array 1 c "
                    119: }
                    120: 
                    121: Arg value 10.5 
                    122: Error: 8192 - Function split() is deprecated, %s(74)
                    123: array(1) {
                    124:   [0]=>
                    125:   string(16) "1 a 1 Array 1 c "
                    126: }
                    127: 
                    128: Arg value -10.5 
                    129: Error: 8192 - Function split() is deprecated, %s(74)
                    130: array(1) {
                    131:   [0]=>
                    132:   string(16) "1 a 1 Array 1 c "
                    133: }
                    134: 
                    135: Arg value 101234567000 
                    136: Error: 8192 - Function split() is deprecated, %s(74)
                    137: array(1) {
                    138:   [0]=>
                    139:   string(16) "1 a 1 Array 1 c "
                    140: }
                    141: 
                    142: Arg value 1.07654321E-9 
                    143: Error: 8192 - Function split() is deprecated, %s(74)
                    144: array(1) {
                    145:   [0]=>
                    146:   string(16) "1 a 1 Array 1 c "
                    147: }
                    148: 
                    149: Arg value 0.5 
                    150: Error: 8192 - Function split() is deprecated, %s(74)
                    151: array(1) {
                    152:   [0]=>
                    153:   string(16) "1 a 1 Array 1 c "
                    154: }
1.1.1.2 ! misho     155: Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
1.1       misho     156: 
                    157: Arg value Array 
                    158: Error: 8192 - Function split() is deprecated, %s(74)
                    159: Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
                    160: NULL
1.1.1.2 ! misho     161: Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
1.1       misho     162: 
                    163: Arg value Array 
                    164: Error: 8192 - Function split() is deprecated, %s(74)
                    165: Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
                    166: NULL
1.1.1.2 ! misho     167: Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
1.1       misho     168: 
                    169: Arg value Array 
                    170: Error: 8192 - Function split() is deprecated, %s(74)
                    171: Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
                    172: NULL
1.1.1.2 ! misho     173: Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
1.1       misho     174: 
                    175: Arg value Array 
                    176: Error: 8192 - Function split() is deprecated, %s(74)
                    177: Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
                    178: NULL
1.1.1.2 ! misho     179: Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
1.1       misho     180: 
                    181: Arg value Array 
                    182: Error: 8192 - Function split() is deprecated, %s(74)
                    183: Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
                    184: NULL
                    185: 
                    186: Arg value  
                    187: Error: 8192 - Function split() is deprecated, %s(74)
                    188: Error: 2 - split(): REG_EMPTY, %s(74)
                    189: bool(false)
                    190: 
                    191: Arg value  
                    192: Error: 8192 - Function split() is deprecated, %s(74)
                    193: Error: 2 - split(): REG_EMPTY, %s(74)
                    194: bool(false)
                    195: 
                    196: Arg value 1 
                    197: Error: 8192 - Function split() is deprecated, %s(74)
                    198: array(4) {
                    199:   [0]=>
                    200:   string(0) ""
                    201:   [1]=>
                    202:   string(3) " a "
                    203:   [2]=>
                    204:   string(7) " Array "
                    205:   [3]=>
                    206:   string(3) " c "
                    207: }
                    208: 
                    209: Arg value  
                    210: Error: 8192 - Function split() is deprecated, %s(74)
                    211: Error: 2 - split(): REG_EMPTY, %s(74)
                    212: bool(false)
                    213: 
                    214: Arg value 1 
                    215: Error: 8192 - Function split() is deprecated, %s(74)
                    216: array(4) {
                    217:   [0]=>
                    218:   string(0) ""
                    219:   [1]=>
                    220:   string(3) " a "
                    221:   [2]=>
                    222:   string(7) " Array "
                    223:   [3]=>
                    224:   string(3) " c "
                    225: }
                    226: 
                    227: Arg value  
                    228: Error: 8192 - Function split() is deprecated, %s(74)
                    229: Error: 2 - split(): REG_EMPTY, %s(74)
                    230: bool(false)
                    231: 
                    232: Arg value  
                    233: Error: 8192 - Function split() is deprecated, %s(74)
                    234: Error: 2 - split(): REG_EMPTY, %s(74)
                    235: bool(false)
                    236: 
                    237: Arg value  
                    238: Error: 8192 - Function split() is deprecated, %s(74)
                    239: Error: 2 - split(): REG_EMPTY, %s(74)
                    240: bool(false)
                    241: Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
                    242: 
                    243: Arg value  
                    244: Error: 8192 - Function split() is deprecated, %s(74)
                    245: Error: 2 - split() expects parameter 1 to be string, object given, %s(74)
                    246: NULL
                    247: 
                    248: Arg value  
                    249: Error: 8192 - Function split() is deprecated, %s(74)
                    250: Error: 2 - split(): REG_EMPTY, %s(74)
                    251: bool(false)
                    252: 
                    253: Arg value  
                    254: Error: 8192 - Function split() is deprecated, %s(74)
                    255: Error: 2 - split(): REG_EMPTY, %s(74)
                    256: bool(false)
                    257: Done

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