Annotation of embedaddon/php/ext/ereg/tests/eregi_replace_variation_002.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test eregi_replace() function : usage variations  - unexpected type arg 2
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : proto string eregi_replace(string pattern, string replacement, string string)
        !             6:  * Description: Replace 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 eregi_replace() : usage variations ***\n";
        !            17: 
        !            18: // Initialise function arguments not being substituted (if any)
        !            19: $pattern = b'ell';
        !            20: $string = 'hello!';
        !            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 replacement
        !            74: 
        !            75: foreach($values as $value) {
        !            76:       echo "\nArg value $value \n";
        !            77:       var_dump(urlencode(eregi_replace($pattern, $value, $string)));
        !            78: };
        !            79: 
        !            80: echo "Done";
        !            81: ?>
        !            82: --EXPECTF--
        !            83: *** Testing eregi_replace() : 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 eregi_replace() is deprecated, %s(74)
        !            89: string(5) "ho%21"
        !            90: 
        !            91: Arg value 1 
        !            92: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !            93: string(8) "h%01o%21"
        !            94: 
        !            95: Arg value 12345 
        !            96: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !            97: string(6) "h9o%21"
        !            98: 
        !            99: Arg value -2345 
        !           100: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           101: string(8) "h%D7o%21"
        !           102: 
        !           103: Arg value 10.5 
        !           104: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           105: string(8) "h%0Ao%21"
        !           106: 
        !           107: Arg value -10.5 
        !           108: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           109: string(8) "h%F6o%21"
        !           110: 
        !           111: Arg value 101234567000 
        !           112: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           113: string(%d) "h%so%21"
        !           114: 
        !           115: Arg value 1.07654321E-9 
        !           116: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           117: string(5) "ho%21"
        !           118: 
        !           119: Arg value 0.5 
        !           120: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           121: string(5) "ho%21"
        !           122: 
        !           123: Arg value Array 
        !           124: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           125: string(5) "ho%21"
        !           126: 
        !           127: Arg value Array 
        !           128: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           129: string(8) "h%01o%21"
        !           130: 
        !           131: Arg value Array 
        !           132: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           133: string(8) "h%01o%21"
        !           134: 
        !           135: Arg value Array 
        !           136: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           137: string(8) "h%01o%21"
        !           138: 
        !           139: Arg value Array 
        !           140: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           141: string(8) "h%01o%21"
        !           142: 
        !           143: Arg value  
        !           144: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           145: string(5) "ho%21"
        !           146: 
        !           147: Arg value  
        !           148: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           149: string(5) "ho%21"
        !           150: 
        !           151: Arg value 1 
        !           152: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           153: string(8) "h%01o%21"
        !           154: 
        !           155: Arg value  
        !           156: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           157: string(5) "ho%21"
        !           158: 
        !           159: Arg value 1 
        !           160: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           161: string(8) "h%01o%21"
        !           162: 
        !           163: Arg value  
        !           164: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           165: string(5) "ho%21"
        !           166: 
        !           167: Arg value  
        !           168: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           169: string(5) "ho%21"
        !           170: 
        !           171: Arg value  
        !           172: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           173: string(5) "ho%21"
        !           174: Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
        !           175: 
        !           176: Arg value  
        !           177: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           178: Error: 8 - Object of class stdClass could not be converted to int, %s(74)
        !           179: string(8) "h%01o%21"
        !           180: 
        !           181: Arg value  
        !           182: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           183: string(5) "ho%21"
        !           184: 
        !           185: Arg value  
        !           186: Error: 8192 - Function eregi_replace() is deprecated, %s(74)
        !           187: string(5) "ho%21"
        !           188: Done

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