]> granicus.if.org Git - php/commitdiff
Convert Errors to ValueErrors
authorGeorge Peter Banyard <girgias@php.net>
Mon, 18 Nov 2019 22:40:02 +0000 (23:40 +0100)
committerGeorge Peter Banyard <girgias@php.net>
Thu, 5 Dec 2019 13:22:54 +0000 (14:22 +0100)
Closes GH-4930

52 files changed:
ext/standard/array.c
ext/standard/assert.c
ext/standard/dir.c
ext/standard/string.c
ext/standard/tests/array/array_chunk2.phpt
ext/standard/tests/array/array_chunk_variation5.phpt
ext/standard/tests/array/array_combine_error2.phpt
ext/standard/tests/array/array_fill_error.phpt
ext/standard/tests/array/array_multisort_error.phpt
ext/standard/tests/array/array_multisort_variation1.phpt
ext/standard/tests/array/array_multisort_variation2.phpt
ext/standard/tests/array/array_multisort_variation3.phpt
ext/standard/tests/array/array_pad.phpt
ext/standard/tests/array/array_push_error2.phpt
ext/standard/tests/array/array_rand.phpt
ext/standard/tests/array/array_rand_variation5.phpt
ext/standard/tests/array/bug43495.phpt
ext/standard/tests/array/bug71220.phpt
ext/standard/tests/array/bug77395.phpt
ext/standard/tests/array/compact_variation1.phpt
ext/standard/tests/array/extract_error.phpt
ext/standard/tests/array/extract_error_variation1.phpt
ext/standard/tests/array/max.phpt
ext/standard/tests/array/min.phpt
ext/standard/tests/array/range_bug70239_0.phpt
ext/standard/tests/array/range_bug70239_1.phpt
ext/standard/tests/array/range_bug70239_2.phpt
ext/standard/tests/array/range_bug70239_3.phpt
ext/standard/tests/array/range_errors.phpt
ext/standard/tests/assert/assert_options_error.phpt
ext/standard/tests/dir/bug41693.phpt
ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt
ext/standard/tests/strings/bug33605.phpt
ext/standard/tests/strings/chunk_split_variation5.phpt
ext/standard/tests/strings/chunk_split_variation8.phpt
ext/standard/tests/strings/dirname_error.phpt
ext/standard/tests/strings/dirname_multi.phpt
ext/standard/tests/strings/dirname_multi_win.phpt
ext/standard/tests/strings/explode.phpt
ext/standard/tests/strings/explode1.phpt
ext/standard/tests/strings/str_pad.phpt
ext/standard/tests/strings/str_repeat.phpt
ext/standard/tests/strings/str_split_variation6.phpt
ext/standard/tests/strings/str_split_variation6_64bit.phpt
ext/standard/tests/strings/str_split_variation7.phpt
ext/standard/tests/strings/str_split_variation7_64bit.phpt
ext/standard/tests/strings/str_word_count.phpt
ext/standard/tests/strings/str_word_count1.phpt
ext/standard/tests/strings/substr_compare.phpt
ext/standard/tests/strings/substr_count_basic.phpt
ext/standard/tests/strings/wordwrap.phpt
ext/standard/tests/strings/wordwrap_error.phpt

index c11ba5886841c845c4e5315a8135a96201093609..618ff2a2d1ea108720737e9b397ed69b9275bc90 100644 (file)
@@ -1263,7 +1263,7 @@ PHP_FUNCTION(min)
                        if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 0)) != NULL) {
                                ZVAL_COPY_DEREF(return_value, result);
                        } else {
-                               zend_throw_error(NULL, "Array must contain at least one element");
+                               zend_value_error("Array must contain at least one element");
                                return;
                        }
                }
@@ -1310,7 +1310,7 @@ PHP_FUNCTION(max)
                        if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 1)) != NULL) {
                                ZVAL_COPY_DEREF(return_value, result);
                        } else {
-                               zend_throw_error(NULL, "Array must contain at least one element");
+                               zend_value_error("Array must contain at least one element");
                                return;
                        }
                }
@@ -2451,18 +2451,18 @@ PHP_FUNCTION(extract)
        extract_type &= 0xff;
 
        if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {
-               zend_throw_error(NULL, "Invalid extract type");
+               zend_value_error("Invalid extract type");
                return;
        }
 
        if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS && ZEND_NUM_ARGS() < 3) {
-               zend_throw_error(NULL, "Specified extract type requires the prefix parameter");
+               zend_value_error("Specified extract type requires the prefix parameter");
                return;
        }
 
        if (prefix) {
                if (ZSTR_LEN(prefix) && !php_valid_var_name(ZSTR_VAL(prefix), ZSTR_LEN(prefix))) {
-                       zend_throw_error(NULL, "Prefix is not a valid identifier");
+                       zend_value_error("Prefix is not a valid identifier");
                        return;
                }
        }
@@ -2619,7 +2619,7 @@ PHP_FUNCTION(array_fill)
 
        if (EXPECTED(num > 0)) {
                if (sizeof(num) > 4 && UNEXPECTED(EXPECTED(num > 0x7fffffff))) {
-                       zend_throw_error(NULL, "Too many elements");
+                       zend_value_error("Too many elements");
                        return;
                } else if (UNEXPECTED(start_key > ZEND_LONG_MAX - num + 1)) {
                        zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
@@ -2668,7 +2668,7 @@ PHP_FUNCTION(array_fill)
        } else if (EXPECTED(num == 0)) {
                RETURN_EMPTY_ARRAY();
        } else {
-               zend_throw_error(NULL, "Number of elements can't be negative");
+               zend_value_error("Number of elements can't be negative");
                return;
        }
 }
@@ -2706,7 +2706,7 @@ PHP_FUNCTION(array_fill_keys)
 #define RANGE_CHECK_DOUBLE_INIT_ARRAY(start, end) do { \
                double __calc_size = ((start - end) / step) + 1; \
                if (__calc_size >= (double)HT_MAX_SIZE) { \
-                       zend_throw_error(NULL, \
+                       zend_value_error(\
                                        "The supplied range exceeds the maximum array size: start=%0.0f end=%0.0f", end, start); \
                        return; \
                } \
@@ -2718,7 +2718,7 @@ PHP_FUNCTION(array_fill_keys)
 #define RANGE_CHECK_LONG_INIT_ARRAY(start, end) do { \
                zend_ulong __calc_size = ((zend_ulong) start - end) / lstep; \
                if (__calc_size >= HT_MAX_SIZE - 1) { \
-                       zend_throw_error(NULL, \
+                       zend_value_error(\
                                        "The supplied range exceeds the maximum array size: start=" ZEND_LONG_FMT " end=" ZEND_LONG_FMT, end, start); \
                        return; \
                } \
@@ -2816,7 +2816,7 @@ double_str:
                high = zval_get_double(zhigh);
 
                if (zend_isinf(high) || zend_isinf(low)) {
-                       zend_throw_error(NULL, "Invalid range supplied: start=%0.0f end=%0.0f", low, high);
+                       zend_value_error("Invalid range supplied: start=%0.0f end=%0.0f", low, high);
                        return;
                }
 
@@ -2909,7 +2909,7 @@ long_str:
        }
 err:
        if (err) {
-               zend_throw_error(NULL, "step exceeds the specified range");
+               zend_value_error("step exceeds the specified range");
                return;
        }
 }
@@ -4389,7 +4389,7 @@ PHP_FUNCTION(array_pad)
        input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
        pad_size_abs = ZEND_ABS(pad_size);
        if (pad_size_abs < 0 || pad_size_abs - input_size > Z_L(1048576)) {
-               zend_throw_error(NULL, "You may only pad up to 1048576 elements at a time");
+               zend_value_error("You may only pad up to 1048576 elements at a time");
                return;
        }
 
@@ -5769,7 +5769,7 @@ PHP_FUNCTION(array_multisort)
        array_size = zend_hash_num_elements(Z_ARRVAL_P(arrays[0]));
        for (i = 0; i < num_arrays; i++) {
                if (zend_hash_num_elements(Z_ARRVAL_P(arrays[i])) != (uint32_t)array_size) {
-                       zend_throw_error(NULL, "Array sizes are inconsistent");
+                       zend_value_error("Array sizes are inconsistent");
                        MULTISORT_ABORT;
                }
        }
@@ -5865,7 +5865,7 @@ PHP_FUNCTION(array_rand)
        num_avail = zend_hash_num_elements(Z_ARRVAL_P(input));
 
        if (num_avail == 0) {
-               zend_throw_error(NULL, "Array is empty");
+               zend_value_error("Array is empty");
                return;
        }
 
@@ -5906,7 +5906,7 @@ PHP_FUNCTION(array_rand)
        }
 
        if (num_req <= 0 || num_req > num_avail) {
-               zend_throw_error(NULL, "Second argument has to be between 1 and the number of elements in the array");
+               zend_value_error("Second argument has to be between 1 and the number of elements in the array");
                return;
        }
 
@@ -6395,7 +6395,7 @@ PHP_FUNCTION(array_chunk)
 
        /* Do bounds checking for size parameter. */
        if (size < 1) {
-               zend_throw_error(NULL, "Size parameter expected to be greater than 0");
+               zend_value_error("Size parameter expected to be greater than 0");
                return;
        }
 
@@ -6460,7 +6460,7 @@ PHP_FUNCTION(array_combine)
        num_values = zend_hash_num_elements(values);
 
        if (num_keys != num_values) {
-               zend_throw_error(NULL, "Both parameters should have an equal number of elements");
+               zend_value_error("Both parameters should have an equal number of elements");
                return;
        }
 
index 8c276eeda81bff9290eb080584527422f021936f..1995ec1da8b6cb61f160f6c9faa957a28679cb96 100644 (file)
@@ -314,7 +314,7 @@ PHP_FUNCTION(assert_options)
                break;
 
        default:
-               zend_throw_error(NULL, "Unknown value " ZEND_LONG_FMT, what);
+               zend_value_error("Unknown value " ZEND_LONG_FMT, what);
                break;
        }
 
index db15948a1da2448ffa76d0a4d8ae968cb1e5f97b..8a17b1e724a614f6d25ffd99e0e39089b05881a3 100644 (file)
@@ -559,7 +559,7 @@ PHP_FUNCTION(scandir)
        ZEND_PARSE_PARAMETERS_END();
 
        if (dirn_len < 1) {
-               zend_throw_error(NULL, "Directory name cannot be empty");
+               zend_value_error("Directory name cannot be empty");
                return;
        }
 
index 5ee935ac9e0394227c6e24fbe9f12b85f2fba357..8209b56860ad47a83d3e6c815ba7d70705a82a6c 100644 (file)
@@ -931,12 +931,12 @@ PHP_FUNCTION(wordwrap)
        }
 
        if (breakchar_len == 0) {
-               zend_throw_error(NULL, "Break string cannot be empty");
+               zend_value_error("Break string cannot be empty");
                return;
        }
 
        if (linelength == 0 && docut) {
-               zend_throw_error(NULL, "Can't force cut when width is zero");
+               zend_value_error("Can't force cut when width is zero");
                return;
        }
 
@@ -1143,7 +1143,7 @@ PHP_FUNCTION(explode)
        ZEND_PARSE_PARAMETERS_END();
 
        if (ZSTR_LEN(delim) == 0) {
-               zend_throw_error(NULL, "Empty delimiter");
+               zend_value_error("Empty delimiter");
                return;
        }
 
@@ -1642,7 +1642,7 @@ PHP_FUNCTION(dirname)
                ZSTR_LEN(ret) = zend_dirname(ZSTR_VAL(ret), str_len);
 #endif
        } else if (levels < 1) {
-               zend_throw_error(NULL, "Invalid argument, levels must be >= 1");
+               zend_value_error("Invalid argument, levels must be >= 1");
                zend_string_efree(ret);
                return;
        } else {
@@ -2155,7 +2155,7 @@ PHP_FUNCTION(chunk_split)
        ZEND_PARSE_PARAMETERS_END();
 
        if (chunklen <= 0) {
-               zend_throw_error(NULL, "Chunk length should be greater than zero");
+               zend_value_error("Chunk length should be greater than zero");
                return;
        }
 
@@ -5287,7 +5287,7 @@ PHP_FUNCTION(str_repeat)
        ZEND_PARSE_PARAMETERS_END();
 
        if (mult < 0) {
-               zend_throw_error(NULL, "Second argument has to be greater than or equal to 0");
+               zend_value_error("Second argument has to be greater than or equal to 0");
                return;
        }
 
@@ -5534,7 +5534,7 @@ PHP_FUNCTION(substr_count)
        ZEND_PARSE_PARAMETERS_END();
 
        if (needle_len == 0) {
-               zend_throw_error(NULL, "Empty substring");
+               zend_value_error("Empty substring");
                return;
        }
 
@@ -5611,12 +5611,12 @@ PHP_FUNCTION(str_pad)
        }
 
        if (pad_str_len == 0) {
-               zend_throw_error(NULL, "Padding string cannot be empty");
+               zend_value_error("Padding string cannot be empty");
                return;
        }
 
        if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) {
-               zend_throw_error(NULL, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH");
+               zend_value_error("Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH");
                return;
        }
 
@@ -5876,7 +5876,7 @@ PHP_FUNCTION(str_word_count)
                        /* nothing to be done */
                        break;
                default:
-                       zend_throw_error(NULL, "Invalid format value " ZEND_LONG_FMT, type);
+                       zend_value_error("Invalid format value " ZEND_LONG_FMT, type);
                        return;
        }
 
@@ -5941,7 +5941,7 @@ PHP_FUNCTION(str_split)
        ZEND_PARSE_PARAMETERS_END();
 
        if (split_length <= 0) {
-               zend_throw_error(NULL, "The length of each segment must be greater than zero");
+               zend_value_error("The length of each segment must be greater than zero");
                return;
        }
 
@@ -6020,7 +6020,7 @@ PHP_FUNCTION(substr_compare)
                if (len == 0) {
                        RETURN_LONG(0L);
                } else {
-                       zend_throw_error(NULL, "The length must be greater than or equal to zero");
+                       zend_value_error("The length must be greater than or equal to zero");
                        return;
                }
        }
index c02194aa5b998ba06313ba9add8b5181b251dbb5..a49ccc4eae25aa034a1478a33c568243372b584e 100644 (file)
@@ -6,13 +6,13 @@ $input_array = array('a', 'b', 'c', 'd', 'e');
 
 try {
     var_dump(array_chunk($input_array, 0));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(array_chunk($input_array, 0, true));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
index 21f1a3dce286afd1a499c442e310de3991814e1f..fca31d51c8c57f9d408760fb0449718518b04a14 100644 (file)
@@ -29,23 +29,22 @@ foreach ($sizes as $size){
     echo "\n-- Testing array_chunk() when size = $size --\n";
     try {
         var_dump( array_chunk($input_array, $size) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
     try {
         var_dump( array_chunk($input_array, $size, true) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
     try {
         var_dump( array_chunk($input_array, $size, false) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
 }
 ?>
 
-DONE
 --EXPECT--
 *** Testing array_chunk() : usage variations ***
 
@@ -146,5 +145,3 @@ array(3) {
     int(3)
   }
 }
-
-DONE
index 463dc6dfe812a351223e0e71f5fdb0cfd27351ad..4eae53c1206677e9e5a0a32e9899e91738dcaf1a 100644 (file)
@@ -18,7 +18,7 @@ var_dump( array_combine(array(), array()) );
 echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n";
 try {
     var_dump( array_combine(array(), array(1, 2)) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage();
 }
 
@@ -26,7 +26,7 @@ try {
 echo "\n-- Testing array_combine() function with empty array for \$values argument --\n";
 try {
     var_dump( array_combine(array(1, 2), array()) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage();
 }
 
@@ -34,13 +34,11 @@ try {
 echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n";
 try {
     var_dump( array_combine(array(1, 2), array(1, 2, 3)) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage();
 }
 
 ?>
-
-DONE
 --EXPECT--
 *** Testing array_combine() : error conditions specific to array_combine() ***
 
@@ -54,4 +52,3 @@ Both parameters should have an equal number of elements
 Both parameters should have an equal number of elements
 -- Testing array_combine() function by passing array with unequal number of elements --
 Both parameters should have an equal number of elements
-DONE
index 63af88bf284ac83014473b7e8d39d72a8f130959..3a9423e2b86335a7d06ae610334d0c17623bbc0d 100644 (file)
@@ -17,15 +17,11 @@ $val = 1;
 
 try {
     var_dump( array_fill($start_key,$num,$val) );
-} catch (Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 ?>
-
-DONE
---EXPECTF--
+--EXPECT--
 *** Testing array_fill() : error conditions ***
 Number of elements can't be negative
-
-DONE
index ddcf74eaae6b4775a590b1cec0aeeed3680e145b..63d59e58f05911a2ec095800ccf77e28aa89b395 100644 (file)
@@ -14,7 +14,7 @@ echo "\n-- Testing array_multisort() function with repeated flags --\n";
 $ar1 = array(1);
 try {
     var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) );
-} catch (Error $e) {
+} catch (\TypeError $e) {
     echo $e->getMessage() . "\n";
 }
 
@@ -22,7 +22,7 @@ echo "\n-- Testing array_multisort() function with repeated flags --\n";
 $ar1 = array(1);
 try {
     var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) );
-} catch (Error $e) {
+} catch (\TypeError $e) {
     echo $e->getMessage() . "\n";
 }
 
index 4c09facb548918e485f5ee8dc0b72a3edac9bdc8..a9126804216b75bb20146d0150f97ec9ca3f6611 100644 (file)
@@ -99,7 +99,7 @@ foreach($inputs as $key =>$value) {
       echo "\n--$key--\n";
       try {
           var_dump( array_multisort($value));
-      } catch (Error $e) {
+      } catch (\ValueError | \TypeError $e) {
           echo $e->getMessage() . "\n";
       }
 };
index 160172fa3b46169ea3f5704ef1569126964357cf..f28988ecfae91cfae81e3e2efcbbdf906a82f556 100644 (file)
@@ -107,7 +107,7 @@ foreach($inputs as $key =>$value) {
     echo "\n--$key--\n";
     try {
         var_dump( array_multisort($ar1, $value) );
-    } catch (Error $e) {
+    } catch (\ValueError | \TypeError $e) {
         echo $e->getMessage() . "\n";
     }
 };
index cedc6814cc0f1a97bc04ff205048ddf64ad6c105..07669d7fd254ca8d39aaa7f4a8c581266840c9a0 100644 (file)
@@ -99,7 +99,7 @@ foreach($inputs as $key =>$value) {
     echo "\n--$key--\n";
     try {
         var_dump( array_multisort($ar1, SORT_REGULAR, $value) );
-    } catch (Error $e) {
+    } catch (\ValueError | \TypeError $e) {
         echo $e->getMessage() . "\n";
     }
 };
index ce6e1b2b040afe110807ec5de3e2943ad9aed22d..e4f8c5ce7f85e84c12eb96b28fb94615975419e0 100644 (file)
@@ -15,13 +15,11 @@ var_dump(array_pad(array("", -1, 2.0), -4, array()));
 
 try {
     var_dump(array_pad(array("", -1, 2.0), 2000000, 0));
-} catch (Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 ?>
-
-DONE
 --EXPECT--
 array(1) {
   [0]=>
@@ -87,5 +85,3 @@ array(4) {
   float(2)
 }
 You may only pad up to 1048576 elements at a time
-
-DONE
index 2d19dbc2465fa870da2ead8e2b43abc1384cff57..ce267f2cd0bcb67f4b1f477dd67e947fb79b0677 100644 (file)
@@ -22,7 +22,6 @@ try {
 }
 var_dump($array);
 
-echo "Done";
 ?>
 --EXPECTF--
 *** Testing array_push() : error conditions ***
@@ -31,4 +30,3 @@ array(1) {
   [%d]=>
   string(3) "max"
 }
-Done
index 589572754829b9dc74c5b33fe4389983970bb1ef..4aebe8c23d2c6da5291378a7e29fac632a637481 100644 (file)
@@ -5,38 +5,37 @@ array_rand() tests
 
 try {
     var_dump(array_rand(array()));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(array_rand(array(), 0));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(array_rand(array(1,2,3), 0));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(array_rand(array(1,2,3), -1));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(array_rand(array(1,2,3), 10));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 var_dump(array_rand(array(1,2,3), 3));
 var_dump(array_rand(array(1,2,3), 2));
 
-echo "Done\n";
 ?>
 --EXPECTF--
 Array is empty
@@ -58,4 +57,3 @@ array(2) {
   [1]=>
   int(%d)
 }
-Done
index 03e20d6e07a877db8ce8f3db558eeb75239728db..04e71bdc4945c90eb56373c4d501ce3dc92723b7 100644 (file)
@@ -34,34 +34,32 @@ var_dump( array_rand($input, 1) );  // with valid $num_req value
 echo"\n-- With num_req = 0 --\n";
 try {
     var_dump( array_rand($input, 0) );  // with $num_req=0
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 echo"\n-- With num_req = -1 --\n";
 try {
     var_dump( array_rand($input, -1) );  // with $num_req=-1
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 echo"\n-- With num_req = -2 --\n";
 try {
     var_dump( array_rand($input, -2) );  // with $num_req=-2
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 echo"\n-- With num_req more than number of members in 'input' array --\n";
 try {
     var_dump( array_rand($input, 13) );  // with $num_req=13
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 ?>
-
-DONE
 --EXPECTF--
 *** Testing array_rand() : with invalid values for 'req_num' ***
 
@@ -82,5 +80,3 @@ Second argument has to be between 1 and the number of elements in the array
 
 -- With num_req more than number of members in 'input' array --
 Second argument has to be between 1 and the number of elements in the array
-
-DONE
index cb011d3d44f29ee12b0a48b5a02fe8f13c7fb302..37c4f6b604ba6c95db0c5dae06ed257d7a82bbb5 100644 (file)
@@ -20,9 +20,5 @@ $a["key1"]["key2"]["key3"] = null;
 $b["key1"]["key2"]["key3"] = null;
 
 ?>
-
-DONE
 --EXPECT--
 Recursion detected
-
-DONE
index ed46b25e186d0fcd4b4cd2c9ba6b695e233bdceb..6a933f5f524128a2b914cf328bde5ef1f8c97695 100644 (file)
@@ -10,7 +10,5 @@ try {
 }
 ?>
 
-OKAY
 --EXPECT--
 Cannot call compact() dynamically
-OKAY
index b90e9dd9765dd0d4d6f813b029b77e853927c824..bca1e3136cfc566b131a7ced8f32b66cf97fd8cc 100644 (file)
@@ -13,7 +13,7 @@ $data = [['aa'=> 'bb',], ['aa'=> 'bb',],];
 
 try {
     array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 ?>
index 9201bc5aa11590fdc08f888c5b1c3a08b98b92e2..ede36efd7e556cab02f7c812398d53c91734fb8a 100644 (file)
@@ -23,24 +23,19 @@ $arr3 = array(&$string);
 
 try {
     var_dump(compact($arr1));
-} catch (\Error $e) {
+} catch (Error $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(compact($arr2));
-} catch (\Error $e) {
+} catch (Error $e) {
     echo $e->getMessage() . "\n";
 }
 
-try {
-    var_dump(compact($arr3));
-} catch (\Error $e) {
-    echo $e->getMessage() . "\n";
-}
-?>
+var_dump(compact($arr3));
 
-DONE
+?>
 --EXPECT--
 *** Testing compact() : usage variations  - arrays containing references ***
 Recursion detected
@@ -49,5 +44,3 @@ array(1) {
   ["c"]=>
   int(3)
 }
-
-DONE
index 2103a1b9a4819561d273c8478e6f38cfd504f3f9..db6569e94c48003e8b78a1eb5506d35e15b32c49 100644 (file)
@@ -11,24 +11,23 @@ $arr = array(1);
 
 try {
     var_dump( extract($arr, -1 . "wddr") );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump( extract($arr, 7 , "wddr") );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 /* Two Arguments, second as prefix but without prefix string as third argument */
 try {
     var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
-echo "Done\n";
 ?>
 --EXPECTF--
 *** Testing Error Conditions ***
@@ -37,4 +36,3 @@ Notice: A non well formed numeric value encountered in %s on line %d
 Invalid extract type
 Invalid extract type
 Specified extract type requires the prefix parameter
-Done
index ec3078a0b9713a4c093fb0f0da9a830ec236fcfb..a0caafb2130e54ddd80933d9c5feec7eee86f523 100644 (file)
@@ -6,7 +6,7 @@ $a = ["1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five"];
 
 try {
     extract($a, EXTR_PREFIX_ALL, '85bogus');
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage();
 }
 ?>
index 9e6448cd520da782c45017781dc38d3c2f97d10f..dacd470ada0e5883df746d665967788163427a6b 100644 (file)
@@ -13,7 +13,7 @@ try {
 
 try {
     var_dump(max(array()));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
@@ -31,7 +31,6 @@ var_dump(max(true, false, true));
 var_dump(max(1, true, false, true));
 var_dump(max(0, true, false, true));
 
-echo "Done\n";
 ?>
 --EXPECT--
 When only one parameter is given, it must be an array
@@ -44,4 +43,3 @@ bool(true)
 bool(true)
 int(1)
 bool(true)
-Done
index 85defa6e855fbddce72279181cfce5c6c7f18cd2..144cd815a81cde74ebb8e47b5c54cd4c34bb4e59 100644 (file)
@@ -13,7 +13,7 @@ try {
 
 try {
     var_dump(min(array()));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
@@ -31,7 +31,6 @@ var_dump(min(true, false, true));
 var_dump(min(1, true, false, true));
 var_dump(min(0, true, false, true));
 
-echo "Done\n";
 ?>
 --EXPECT--
 When only one parameter is given, it must be an array
@@ -44,4 +43,3 @@ bool(false)
 bool(false)
 bool(false)
 int(0)
-Done
index 048d40737b15ed1d977d0cad610e30ca3219c9cb..c5e56462c52ebea78ee412d59c7dfb42065751dc 100644 (file)
@@ -4,7 +4,7 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var
 <?php
 try {
     range(0, pow(2.0, 100000000));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 ?>
index 9ab62870b1c318ac228671c7aeac3eab803eb741..cfaa1a51fc586cc0256bc526e9da5644c2f4424e 100644 (file)
@@ -4,7 +4,7 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var
 <?php
 try {
     range(pow(2.0, 100000000), pow(2.0, 100000000) + 1);
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 ?>
index 192644cd0fd99e3c0f31e6b51cfdfcb3168825f5..1ccf8d0373baccac1d02fc36159b400be26a39d1 100644 (file)
@@ -4,7 +4,7 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var
 <?php
 try {
     var_dump(range(0, PHP_INT_MAX));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 ?>
index f1f7c94b896647d2f125b22002708e15d552cc6c..5d50db4f4a2b8846a0cea4451f81f244440d2319 100644 (file)
@@ -4,7 +4,7 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var
 <?php
 try {
     var_dump(range(PHP_INT_MIN, 0));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 ?>
index 971eade4bef365b43e9ae730234a4e0b2dde2fb9..d2dbfd5d67886c3e7d4c3e12d0b1a1ea173b5937 100644 (file)
@@ -10,67 +10,65 @@ echo "\n*** Testing error conditions ***\n";
 echo "\n-- Testing ( (low < high) && (step = 0) ) --\n";
 try {
     var_dump( range(1, 2, 0) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage(), "\n";
 }
 
 try {
     var_dump( range("a", "b", 0) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage(), "\n";
 }
 
 echo "\n\n-- Testing ( (low > high) && (step = 0) ) --\n";
 try {
     var_dump( range(2, 1, 0) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage(), "\n";
 }
 
 try {
     var_dump( range("b", "a", 0) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage(), "\n";
 }
 
 echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --\n";
 try {
     var_dump( range(1.0, 7.0, 6.5) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage(), "\n";
 }
 
 echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --\n";
 try {
     var_dump( range(7.0, 1.0, 6.5) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage(), "\n";
 }
 
 echo "\n-- Testing other conditions --\n";
 try {
     var_dump( range(-1, -2, 2) );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage(), "\n";
 }
 
 try {
     var_dump( range("a", "j", "z") );
-} catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
-} catch (\Error $e) {
+} catch (\TypeError $e) {
     echo $e->getMessage(), "\n";
 }
 
 try {
     var_dump( range(0, 1, "140962482048819216326.24") );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage(), "\n";
 }
 
 try {
     var_dump( range(0, 1, "140962482048819216326.24.") );
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage(), "\n";
 }
 
@@ -80,14 +78,10 @@ $step_arr = array( "string", NULL, FALSE, "", "\0" );
 foreach( $step_arr as $step ) {
     try {
         var_dump( range( 1, 5, $step ) );
-    } catch (\TypeError $e) {
-        echo $e->getMessage(), "\n";
-    } catch (\Error $e) {
+    } catch (\TypeError | \ValueError $e) {
         echo $e->getMessage(), "\n";
     }
 }
-
-echo "Done\n";
 ?>
 --EXPECTF--
 *** Testing error conditions ***
@@ -123,4 +117,3 @@ step exceeds the specified range
 step exceeds the specified range
 range() expects parameter 3 to be int or float, string given
 range() expects parameter 3 to be int or float, string given
-Done
index 0b50370b6cfaae63b7c9458b0f07278cf1fa84b4..ed94260ef832e655eaa1638a51c86303670c25b1 100644 (file)
@@ -5,9 +5,9 @@ assert_options() - unknown assert option.
 <?php
 try {
     assert_options(1000);
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage();
 }
 ?>
 --EXPECT--
-Unknown value 1000
\ No newline at end of file
+Unknown value 1000
index c42ca2faea70245a8b218c79d285c06bdc49dbdb..2f9fcabb9addc3b727db2dbaf4985c482687a5c8 100644 (file)
@@ -5,7 +5,7 @@ Bug #41693 (scandir() allows empty directory names)
 
 try {
     var_dump(scandir(''));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
index 2949bd3381e3e91cdb47283bfacb0798588c9627..8a43fec34b24a607dc8a8872ef55e70f83f56485 100644 (file)
@@ -63,4 +63,3 @@ Directory::close(): supplied argument is not a valid Directory resource
 Unable to find my handle property
 Unable to find my handle property
 Unable to find my handle property
-
index b3cb2ece957cbd0b911eacb14203d3059020e3c5..dd937851ca03d447fe8af837a3994709c4094b4f 100644 (file)
@@ -4,10 +4,10 @@ Bug #33605 (substr_compare crashes)
 <?php
 try {
     substr_compare("aa", "a", -99999999, -1, 0);
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage();
 }
 
 ?>
---EXPECTF--
+--EXPECT--
 The length must be greater than or equal to zero
index bea49d24b48923832a447ba07d197f477c4f7d6f..bfcaa54e265a2459e06dfa35ea0c0d2374515e36 100644 (file)
Binary files a/ext/standard/tests/strings/chunk_split_variation5.phpt and b/ext/standard/tests/strings/chunk_split_variation5.phpt differ
index 15c224962e103839466c544de26b79241fe6dc74..74b41ede03a225a00c07d955ba6f51aad4788f29 100644 (file)
@@ -50,14 +50,13 @@ for($count = 0; $count < count($values); $count++) {
     var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
   } catch (TypeError $e) {
     echo $e->getMessage(), "\n";
-  } catch (\Error $e) {
+  } catch (\ValueError $e) {
       echo $e->getMessage() . "\n";
   }
 }
 
-echo "Done"
 ?>
---EXPECTF--
+--EXPECT--
 *** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***
 -- Iteration 1 --
 Chunk length should be greater than zero
@@ -87,4 +86,3 @@ chunk_split():::"
 chunk_split() expects parameter 2 to be int, float given
 -- Iteration 8 --
 Chunk length should be greater than zero
-Done
index daf4e2cb0aa883af1c1b18091025e280230c2240..99d0f288072d44ccaaa801ba97ba776243210217 100644 (file)
@@ -10,13 +10,11 @@ echo "*** Testing error conditions ***\n";
 // Bad arg
 try {
     dirname("/var/tmp/bar.gz", 0);
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
-echo "Done\n";
 ?>
---EXPECTF--
+--EXPECT--
 *** Testing error conditions ***
 Invalid argument, levels must be >= 1
-Done
index f95bf16d2a39c9ffcba0758fa7931bab53dcfbb0..eb29de39a234a49843fe5c1afb14f32dc64ff73c 100644 (file)
@@ -13,18 +13,16 @@ if((substr(PHP_OS, 0, 3) == "WIN"))
 for ($i=0 ; $i<5 ; $i++) {
     try {
            var_dump(dirname("/foo/bar/baz", $i));
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
 }
 var_dump(dirname("/foo/bar/baz", PHP_INT_MAX));
 ?>
-Done
---EXPECTF--
+--EXPECT--
 Invalid argument, levels must be >= 1
 string(8) "/foo/bar"
 string(4) "/foo"
 string(1) "/"
 string(1) "/"
 string(1) "/"
-Done
index 9dc0c05c59732301a575695ccb5a702bad709e5a..d63d5e79502064fd8f709a87e6157839b033fd79 100644 (file)
@@ -14,7 +14,7 @@ if((substr(PHP_OS, 0, 3) != "WIN"))
 for ($i=0 ; $i<5 ; $i++) {
     try {
         var_dump(dirname("/foo/bar/baz", $i));
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
 }
@@ -23,7 +23,6 @@ var_dump(dirname("/foo/bar/baz", PHP_INT_MAX));
 var_dump(dirname("g:/foo/bar/baz", PHP_INT_MAX));
 var_dump(dirname("g:foo/bar/baz", PHP_INT_MAX));
 ?>
-Done
 --EXPECT--
 Invalid argument, levels must be >= 1
 string(8) "/foo/bar"
@@ -33,4 +32,3 @@ string(1) "\"
 string(1) "\"
 string(3) "g:\"
 string(3) "g:."
-Done
index 8fa3b6207926465ebea1e6294afc5edf6eb5f355..8375364175a5c6866e54b08fea1cd14a07b82617 100644 (file)
@@ -14,17 +14,17 @@ echo "\n";
 
 try {
     var_dump(explode("", ""));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 try {
     var_dump(explode("", NULL));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 try {
     var_dump(explode(NULL, ""));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
@@ -33,7 +33,7 @@ var_dump(explode("a", "a"));
 var_dump(explode("a", NULL));
 try {
     var_dump(explode(NULL, "a"));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 var_dump(explode("abc", "acb"));
index 4d692e49e8041ea4f8eef309d177cbbedce15140..191ab1207c692adeb46f99867d3b207b31b12e7f 100644 (file)
@@ -36,22 +36,22 @@ foreach($delimiters as $delimiter) {
 
     try {
         var_dump( explode($delimiter, $string, -1) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
     try {
            var_dump( explode($delimiter, $string, 0) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
     try {
            var_dump( explode($delimiter, $string, 1) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
     try {
            var_dump( explode($delimiter, $string, 2) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
     $counter++;
@@ -94,9 +94,8 @@ class string1 {
 $obj = new string1;
 var_dump( explode("b", $obj) );
 
-echo "Done\n";
 ?>
---EXPECTF--
+--EXPECT--
 *** Testing explode() for basic operations ***
 -- Iteration 1 --
 Empty delimiter
@@ -486,4 +485,3 @@ array(2) {
   [1]=>
   string(4) "ject"
 }
-Done
index a4f60bfa6ae277ebee476fe74613024d5dc0029d..42b6383a5e487cbbebc43be1299c4e94c706d3cd 100644 (file)
@@ -67,13 +67,13 @@ echo "\n--- padding string as null ---\n";
 
 try {
     str_pad($input_string, 12, NULL);
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     str_pad($input_string, 12, "");
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
@@ -81,11 +81,10 @@ try {
 
 try {
     str_pad($input_string, $pad_length, "+", 15);
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
-echo "Done\n";
 ?>
 --EXPECT--
 #### Basic operations ####
@@ -343,4 +342,3 @@ string(16) "\t\variation\t\t"
 Padding string cannot be empty
 Padding string cannot be empty
 Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH
-Done
index 6e5f0cf68e618ec40a8e0db1fabfba3406d77b3f..4751dc783ffc1d72d635fb0324a43c99d7b385ba 100644 (file)
Binary files a/ext/standard/tests/strings/str_repeat.phpt and b/ext/standard/tests/strings/str_repeat.phpt differ
index 111eb11858aa47ea1e71cdc014c6b19c90ef5b0e..2d73a06d100af0b0a9605b9fb4fc31f35b8f663b 100644 (file)
@@ -39,11 +39,10 @@ for($count = 0; $count < count($values); $count++) {
 
     try {
            var_dump( str_split($str, $values[$count]) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
 }
-echo "Done"
 ?>
 --EXPECT--
 *** Testing str_split() : different integer values for 'split_length' ***
@@ -157,4 +156,3 @@ array(1) {
 }
 -- Iteration 7 --
 The length of each segment must be greater than zero
-Done
index e6893e9263ea5600c2dba8234e349d794febe01b..f9cd29cef33e46f69163af1918805e9960900cc2 100644 (file)
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
 * passing different integer values for 'split_length' argument to str_split()
 */
 
-echo "*** Testing str_split() : different intger values for 'split_length' ***\n";
+echo "*** Testing str_split() : different integer values for 'split_length' ***\n";
 //Initialise variables
 $str = 'This is a string with 123 & escape char \t';
 
@@ -39,14 +39,13 @@ for($count = 0; $count < count($values); $count++) {
     echo "-- Iteration ".($count + 1)." --\n";
     try {
         var_dump( str_split($str, $values[$count]) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
 }
-echo "Done"
 ?>
 --EXPECT--
-*** Testing str_split() : different intger values for 'split_length' ***
+*** Testing str_split() : different integer values for 'split_length' ***
 -- Iteration 1 --
 The length of each segment must be greater than zero
 -- Iteration 2 --
@@ -162,4 +161,3 @@ array(1) {
 }
 -- Iteration 8 --
 The length of each segment must be greater than zero
-Done
index a810dd7ecb4d0db6990c1098f91453d6f8b08611..4d28b765acc89d4195bd5ffb4fd8a48e1a0c1979 100644 (file)
@@ -41,11 +41,10 @@ for($count = 0; $count < count($values); $count++) {
 
     try {
            var_dump( str_split($str, $values[$count]) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
 }
-echo "Done"
 ?>
 --EXPECT--
 *** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***
@@ -135,4 +134,3 @@ array(1) {
 }
 -- Iteration 7 --
 The length of each segment must be greater than zero
-Done
index 1a1980028a21479d6e9e4092af4e7c1c77ec7d77..d1771e6e2da21a0e3b1eb2cf1671c12022b759f8 100644 (file)
@@ -41,11 +41,10 @@ for($count = 0; $count < count($values); $count++) {
     echo "-- Iteration ".($count + 1)." --\n";
     try {
         var_dump( str_split($str, $values[$count]) );
-    } catch (\Error $e) {
+    } catch (\ValueError $e) {
         echo $e->getMessage() . "\n";
     }
 }
-echo "Done"
 ?>
 --EXPECT--
 *** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***
@@ -140,4 +139,3 @@ array(1) {
 }
 -- Iteration 8 --
 The length of each segment must be greater than zero
-Done
index 375f26dee0340b6744049310b8d36abebfc0e0a0..480ee5b64a625a53ce753fa7291cac49beb5b329 100644 (file)
@@ -11,25 +11,25 @@ var_dump(str_word_count($str));
 
 try {
     var_dump(str_word_count($str, 3));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(str_word_count($str, 123));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(str_word_count($str, -1));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(str_word_count($str, 999999999));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
index 6ce8c38f225d7d4cc240493bcd3b6b7e10b3da94..9eab1afcbc78e31e9344097bdf6fbdcade6b414f 100644 (file)
@@ -7,20 +7,18 @@ var_dump(str_word_count(""));
 
 try {
     var_dump(str_word_count("", -1));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 try {
     var_dump(str_word_count("", -1, $a));
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
 var_dump($a);
 ?>
-
-DONE
 --EXPECTF--
 int(0)
 Invalid format value -1
@@ -30,5 +28,3 @@ Invalid format value -1
 
 Warning: Undefined variable: a in %s on line %d
 NULL
-
-DONE
index 6a0bca43369ddc9e570582df3f1df0a4937d54f1..52de7fe394d17358f34c00b369dc7d39f50c4ad7 100644 (file)
@@ -17,14 +17,12 @@ echo "Test\n";
 
 try {
     substr_compare("abcde", "abc", 0, -1);
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0);
-
-echo "Done\n";
 ?>
---EXPECTF--
+--EXPECT--
 bool(true)
 bool(true)
 int(0)
@@ -38,4 +36,3 @@ int(0)
 Test
 The length must be greater than or equal to zero
 bool(true)
-Done
index a6d715ed6739498326f4916260a00320b1490db1..df77bfd7214031d57e208a5c1c724bb4a32987bd 100644 (file)
@@ -6,12 +6,12 @@ Test substr_count() function (basic)
 echo "***Testing basic operations ***\n";
 try {
     substr_count("", "");
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 try {
     substr_count("a", "");
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 var_dump(substr_count("", "a"));
@@ -31,8 +31,6 @@ var_dump(substr_count($a, "bca", -200, null));
 var_dump(substr_count($a, "bca", -200, 50));
 var_dump(substr_count($a, "bca", -200, -50));
 
-echo "Done\n";
-
 ?>
 --EXPECT--
 ***Testing basic operations ***
@@ -50,4 +48,3 @@ int(40)
 int(40)
 int(10)
 int(30)
-Done
index 8c2b08f0462e7d19f6c6617b452d4e6d63d1a3d0..0563b2e77faddc055765a256b675f01a4126140d 100644 (file)
@@ -35,7 +35,7 @@ echo "\n";
 
 try {
     wordwrap(chr(0), 0, "");
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 --EXPECT--
index f0fa80f63d44079b1d00578603585a6af6d177ed..af0f8eb61be3c32f52a5406a331966e9a3529b3b 100644 (file)
@@ -29,7 +29,7 @@ $cut = true;
 
 try {
     wordwrap($str, $width, $break, $cut);
-} catch (\Error $e) {
+} catch (\ValueError $e) {
     echo $e->getMessage() . "\n";
 }
 
@@ -44,10 +44,8 @@ echo "-- width = -10 & cut = true --\n";
 $width = -10;
 $cut = true;
 var_dump( wordwrap($str, $width, $break, $cut) );
-
-echo "Done\n";
 ?>
---EXPECTF--
+--EXPECT--
 *** Testing wordwrap() : error conditions ***
 
 -- Testing wordwrap() function with negative/zero value for width argument --
@@ -59,4 +57,3 @@ Can't force cut when width is zero
 string(39) "testing<br />\nwordwrap<br />\nfunction"
 -- width = -10 & cut = true --
 string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
-Done