Annotation of embedaddon/php/ext/ereg/tests/ereg_variation_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test ereg() function : usage variations - unexpected type arg 1
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : proto int ereg(string pattern, string string [, array registers])
! 6: * Description: Regular expression match
! 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:
! 17: echo "*** Testing ereg() : usage variations ***\n";
! 18:
! 19: // Initialise function arguments not being substituted (if any)
! 20: $string = '1';
! 21: $registers = array(1, 2);
! 22:
! 23: //get an unset variable
! 24: $unset_var = 10;
! 25: unset ($unset_var);
! 26:
! 27: //array of values to iterate over
! 28: $values = array(
! 29:
! 30: // int data
! 31: 0,
! 32: 1,
! 33: 12345,
! 34: -2345,
! 35:
! 36: // float data
! 37: 10.5,
! 38: -10.5,
! 39: 10.1234567e10,
! 40: 10.7654321E-10,
! 41: .5,
! 42:
! 43: // array data
! 44: array(),
! 45: array(0),
! 46: array(1),
! 47: array(1, 2),
! 48: array('color' => 'red', 'item' => 'pen'),
! 49:
! 50: // null data
! 51: NULL,
! 52: null,
! 53:
! 54: // boolean data
! 55: true,
! 56: false,
! 57: TRUE,
! 58: FALSE,
! 59:
! 60: // empty data
! 61: "",
! 62: '',
! 63:
! 64: // object data
! 65: new stdclass(),
! 66:
! 67: // undefined data
! 68: $undefined_var,
! 69:
! 70: // unset data
! 71: $unset_var,
! 72: );
! 73:
! 74: // loop through each element of the array for pattern
! 75:
! 76: foreach($values as $value) {
! 77: echo "\nArg value $value \n";
! 78: var_dump( ereg($value, $string, $registers) );
! 79: };
! 80:
! 81: echo "Done";
! 82: ?>
! 83: --EXPECTF--
! 84: *** Testing ereg() : usage variations ***
! 85: Error: 8 - Undefined variable: undefined_var, %s(65)
! 86: Error: 8 - Undefined variable: unset_var, %s(68)
! 87:
! 88: Arg value 0
! 89: Error: 8192 - Function ereg() is deprecated, %s(75)
! 90: bool(false)
! 91:
! 92: Arg value 1
! 93: Error: 8192 - Function ereg() is deprecated, %s(75)
! 94: int(1)
! 95:
! 96: Arg value 12345
! 97: Error: 8192 - Function ereg() is deprecated, %s(75)
! 98: bool(false)
! 99:
! 100: Arg value -2345
! 101: Error: 8192 - Function ereg() is deprecated, %s(75)
! 102: bool(false)
! 103:
! 104: Arg value 10.5
! 105: Error: 8192 - Function ereg() is deprecated, %s(75)
! 106: bool(false)
! 107:
! 108: Arg value -10.5
! 109: Error: 8192 - Function ereg() is deprecated, %s(75)
! 110: bool(false)
! 111:
! 112: Arg value 101234567000
! 113: Error: 8192 - Function ereg() is deprecated, %s(75)
! 114: bool(false)
! 115:
! 116: Arg value 1.07654321E-9
! 117: Error: 8192 - Function ereg() is deprecated, %s(75)
! 118: bool(false)
! 119:
! 120: Arg value 0.5
! 121: Error: 8192 - Function ereg() is deprecated, %s(75)
! 122: bool(false)
! 123:
! 124: Arg value Array
! 125: Error: 8192 - Function ereg() is deprecated, %s(75)
! 126: Error: 8 - Array to string conversion, %s(75)
! 127: bool(false)
! 128:
! 129: Arg value Array
! 130: Error: 8192 - Function ereg() is deprecated, %s(75)
! 131: Error: 8 - Array to string conversion, %s(75)
! 132: bool(false)
! 133:
! 134: Arg value Array
! 135: Error: 8192 - Function ereg() is deprecated, %s(75)
! 136: Error: 8 - Array to string conversion, %s(75)
! 137: bool(false)
! 138:
! 139: Arg value Array
! 140: Error: 8192 - Function ereg() is deprecated, %s(75)
! 141: Error: 8 - Array to string conversion, %s(75)
! 142: bool(false)
! 143:
! 144: Arg value Array
! 145: Error: 8192 - Function ereg() is deprecated, %s(75)
! 146: Error: 8 - Array to string conversion, %s(75)
! 147: bool(false)
! 148:
! 149: Arg value
! 150: Error: 8192 - Function ereg() is deprecated, %s(75)
! 151: Error: 2 - ereg(): REG_EMPTY, %s(75)
! 152: bool(false)
! 153:
! 154: Arg value
! 155: Error: 8192 - Function ereg() is deprecated, %s(75)
! 156: Error: 2 - ereg(): REG_EMPTY, %s(75)
! 157: bool(false)
! 158:
! 159: Arg value 1
! 160: Error: 8192 - Function ereg() is deprecated, %s(75)
! 161: int(1)
! 162:
! 163: Arg value
! 164: Error: 8192 - Function ereg() is deprecated, %s(75)
! 165: Error: 2 - ereg(): REG_EMPTY, %s(75)
! 166: bool(false)
! 167:
! 168: Arg value 1
! 169: Error: 8192 - Function ereg() is deprecated, %s(75)
! 170: int(1)
! 171:
! 172: Arg value
! 173: Error: 8192 - Function ereg() is deprecated, %s(75)
! 174: Error: 2 - ereg(): REG_EMPTY, %s(75)
! 175: bool(false)
! 176:
! 177: Arg value
! 178: Error: 8192 - Function ereg() is deprecated, %s(75)
! 179: Error: 2 - ereg(): REG_EMPTY, %s(75)
! 180: bool(false)
! 181:
! 182: Arg value
! 183: Error: 8192 - Function ereg() is deprecated, %s(75)
! 184: Error: 2 - ereg(): REG_EMPTY, %s(75)
! 185: bool(false)
! 186: Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
! 187:
! 188: Arg value
! 189: Error: 8192 - Function ereg() is deprecated, %s(75)
! 190: Error: 4096 - Object of class stdClass could not be converted to string, %s(75)
! 191: Error: 8 - Object of class stdClass to string conversion, %s(75)
! 192: bool(false)
! 193:
! 194: Arg value
! 195: Error: 8192 - Function ereg() is deprecated, %s(75)
! 196: Error: 2 - ereg(): REG_EMPTY, %s(75)
! 197: bool(false)
! 198:
! 199: Arg value
! 200: Error: 8192 - Function ereg() is deprecated, %s(75)
! 201: Error: 2 - ereg(): REG_EMPTY, %s(75)
! 202: bool(false)
! 203: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>