]> granicus.if.org Git - php/commitdiff
Improve some ValueError messages
authorMáté Kocsis <kocsismate@woohoolabs.com>
Wed, 1 Apr 2020 21:32:39 +0000 (23:32 +0200)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Mon, 6 Apr 2020 08:41:01 +0000 (10:41 +0200)
Closes GH-5340

54 files changed:
ext/bz2/bz2.c
ext/bz2/tests/001.phpt
ext/bz2/tests/003-mb.phpt
ext/bz2/tests/003.phpt
ext/calendar/cal_unix.c
ext/calendar/calendar.c
ext/calendar/easter.c
ext/calendar/tests/cal_days_in_month_error1.phpt
ext/calendar/tests/cal_from_jd_error1.phpt
ext/calendar/tests/cal_info.phpt
ext/calendar/tests/cal_to_jd_error1.phpt
ext/calendar/tests/easter_date.phpt
ext/calendar/tests/unixtojd_error1.phpt
ext/gd/gd.c
ext/gd/tests/bug38212-mb.phpt
ext/gd/tests/bug38212.phpt
ext/gd/tests/bug55005.phpt
ext/gd/tests/bug72494.phpt
ext/gd/tests/bug72697.phpt
ext/gd/tests/bug72709.phpt
ext/gd/tests/bug72730.phpt
ext/gd/tests/imagecolorallocate_variation5.phpt
ext/gd/tests/imagecolorallocate_variation6.phpt
ext/gd/tests/imagecolordeallocate_error3.phpt
ext/gd/tests/imagecolordeallocate_error4.phpt
ext/gd/tests/imageconvolution_error2.phpt
ext/gd/tests/imageconvolution_error3.phpt
ext/gd/tests/imagecreate_error.phpt
ext/gd/tests/imagecreatetruecolor_error2.phpt
ext/gd/tests/imagetruecolortopalette_error3.phpt
ext/gd/tests/imagetruecolortopalette_error4.phpt
ext/json/json.c
ext/json/tests/bug72787.phpt
ext/json/tests/json_decode_error.phpt
ext/sqlite3/sqlite3.c
ext/standard/array.c
ext/standard/assert.c
ext/standard/basic_functions.c
ext/standard/dir.c
ext/standard/dns.c
ext/standard/dns_win32.c
ext/standard/file.c
ext/standard/tests/array/count_invalid_mode.phpt
ext/standard/tests/array/extract_error.phpt
ext/standard/tests/assert/assert_options_error.phpt
ext/standard/tests/dir/bug41693.phpt
ext/standard/tests/file/bug71882.phpt
ext/standard/tests/file/file_variation6.phpt
ext/standard/tests/file/filesize_variation3.phpt
ext/standard/tests/file/ftruncate.phpt
ext/standard/tests/file/ftruncate_variation4.phpt
ext/standard/tests/file/userstreams_005.phpt
ext/standard/tests/general_functions/putenv.phpt
ext/standard/tests/network/bug41347.phpt

index 29046e7122093c5d5c510824fe6040c007b7f60f..360f9d9c20583715f8c01da3f6de6c462a771b94 100644 (file)
@@ -317,7 +317,7 @@ PHP_FUNCTION(bzread)
        php_stream_from_zval(stream, bz);
 
        if (len  < 0) {
-               zend_value_error("Length cannot be negative");
+               zend_argument_value_error(2, "must be greater than or equal to 0");
                RETURN_THROWS();
        }
 
@@ -345,7 +345,7 @@ PHP_FUNCTION(bzopen)
        }
 
        if (mode_len != 1 || (mode[0] != 'r' && mode[0] != 'w')) {
-               zend_value_error("'%s' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.", mode);
+               zend_argument_value_error(2, "must be a valid mode. Only 'w' and 'r' are supported");
                RETURN_THROWS();
        }
 
index 1064e2b6a5214b21f35dd50c7ba743970f888e1b..081558a7d4d49a59e7467ad91d05f0290e39174a 100644 (file)
@@ -37,15 +37,15 @@ var_dump(bzopen($fp, "r"));
 
 ?>
 --EXPECTF--
-'' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.
+bzopen(): Argument #2 ($mode) must be a valid mode. Only 'w' and 'r' are supported
 
 Warning: bzopen(): Filename cannot be empty in %s on line %d
 bool(false)
 
 Warning: bzopen(): Filename cannot be empty in %s on line %d
 bool(false)
-'x' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.
-'rw' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.
+bzopen(): Argument #2 ($mode) must be a valid mode. Only 'w' and 'r' are supported
+bzopen(): Argument #2 ($mode) must be a valid mode. Only 'w' and 'r' are supported
 
 Warning: bzopen(no_such_file): Failed to open stream: No such file or directory in %s on line %d
 bool(false)
index c01a3d18c81caeb5575da9f633e42ed89d969215..75ec54ae4ded1d3cbed5b0a5f90ccd0ac7dc7fcb 100644 (file)
@@ -21,7 +21,7 @@ var_dump(bzread($fd, 100000));
 ?>
 --EXPECT--
 string(0) ""
-Length cannot be negative
+bzread(): Argument #2 ($length) must be greater than or equal to 0
 string(1) "R"
 string(2) "is"
 string(251) "ing up from the heart of the desert
index 6c1f8ea4a98737bbb1e87a5caa7df4786ed71a40..229dd87058cbd45183fc4507e5721ed8fdef2f59 100644 (file)
@@ -21,7 +21,7 @@ var_dump(bzread($fd, 100000));
 ?>
 --EXPECT--
 string(0) ""
-Length cannot be negative
+bzread(): Argument #2 ($length) must be greater than or equal to 0
 string(1) "R"
 string(2) "is"
 string(251) "ing up from the heart of the desert
index 1d3401283de17eda701d7769f9734c50cbcdfe13..47387726498f1bf1e1ce0b6eed63fe2600bdacbb 100644 (file)
@@ -35,7 +35,7 @@ PHP_FUNCTION(unixtojd)
        if (!ts) {
                ts = time(NULL);
        } else if (ts < 0) {
-               zend_value_error("Timestamp must not be negative");
+               zend_argument_value_error(1, "must be greater than or equal to 0");
                RETURN_THROWS();
        }
 
index 32b229c41d32e9046b7f58c7d6162ccfba6735bc..2853e727754e4a8c984310a94d30fa5508055fb6 100644 (file)
@@ -194,7 +194,7 @@ PHP_FUNCTION(cal_info)
 
 
        if (cal != -1 && (cal < 0 || cal >= CAL_NUM_CALS)) {
-               zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
+               zend_argument_value_error(1, "must be a valid calendar ID");
                RETURN_THROWS();
        }
 
@@ -216,7 +216,7 @@ PHP_FUNCTION(cal_days_in_month)
        }
 
        if (cal < 0 || cal >= CAL_NUM_CALS) {
-               zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
+               zend_argument_value_error(1, "must be a valid calendar ID");
                RETURN_THROWS();
        }
 
@@ -262,7 +262,7 @@ PHP_FUNCTION(cal_to_jd)
        }
 
        if (cal < 0 || cal >= CAL_NUM_CALS) {
-               zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
+               zend_argument_value_error(1, "must be a valid calendar ID");
                RETURN_THROWS();
        }
 
@@ -283,7 +283,7 @@ PHP_FUNCTION(cal_from_jd)
        }
 
        if (cal < 0 || cal >= CAL_NUM_CALS) {
-               zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
+               zend_argument_value_error(2, "must be a valid calendar ID");
                RETURN_THROWS();
        }
        calendar = &cal_conversion_table[cal];
index 98087d318cd70c9c392dea69d69048f3b3013ae2..7f26de0c006ab8ba4a67262e16cbdd42bc59b973 100644 (file)
@@ -49,7 +49,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, zend_long gm)
        }
 
        if (gm && (year<1970 || year>2037)) {                           /* out of range for timestamps */
-               zend_value_error("This function is only valid for years between 1970 and 2037 inclusive");
+               zend_argument_value_error(1, "must be between 1970 and 2037 (inclusive)");
                RETURN_THROWS();
        }
 
index b7c82f2cbef5c9ca57c10508bde577a9274d4750..2b7ee0ea88ff02e1faced5ed2a446e032fb43076 100644 (file)
@@ -18,5 +18,5 @@ try{
 }
 ?>
 --EXPECT--
-Invalid calendar ID: -1
+cal_days_in_month(): Argument #1 ($calendar) must be a valid calendar ID
 Invalid date
index 8539117c0d169d5a7d3fe4203cd76b7e3fa5fcbe..feafe240b5aac1d753823616165e09b223a9db1a 100644 (file)
@@ -13,4 +13,4 @@ try {
 }
 ?>
 --EXPECT--
-Invalid calendar ID: -1
+cal_from_jd(): Argument #2 ($calendar) must be a valid calendar ID
index 3e7e3b31883db235e139387a37815954f77dd98a..0d4b823486977dc53b499549f64e7b77707f2582 100644 (file)
@@ -216,4 +216,4 @@ Array
     [calname] => Julian
     [calsymbol] => CAL_JULIAN
 )
-Invalid calendar ID: 99999
+cal_info(): Argument #1 ($calendar) must be a valid calendar ID
index c1911a77b7d5cd1f30483ab7622a1215c8a2f247..b8585c7f0539854ac840059f825fe2cb88d19c2d 100644 (file)
@@ -13,4 +13,4 @@ try {
 }
 ?>
 --EXPECT--
-Invalid calendar ID: -1
+cal_to_jd(): Argument #1 ($calendar) must be a valid calendar ID
index a7cdbea51642809a821c435f62575555e02a2ec3..c784f02ebd1c557028a548f9f097809e7b2660e1 100644 (file)
@@ -22,4 +22,4 @@ try {
 2000-04-23
 2001-04-15
 2002-03-31
-This function is only valid for years between 1970 and 2037 inclusive
+easter_date(): Argument #1 ($year) must be between 1970 and 2037 (inclusive)
index 856fc1bcf43a4b487f28c1fd42f0e6a871dbcbea..000f047f0adbcd7ba48acd2bfdf22fa5c04ec82d 100644 (file)
@@ -20,7 +20,7 @@ var_dump(unixtojd(null)) . PHP_EOL;
 var_dump(unixtojd(time())) . PHP_EOL;
 ?>
 --EXPECTF--
-Timestamp must not be negative
+unixtojd(): Argument #1 ($timestamp) must be greater than or equal to 0
 int(%d)
 int(%d)
 int(%d)
index 5bb840aad8edf7166b1e534a0120a130972691b9..157460b50bc5b0592bb8ccc9355408bbc40e1489 100644 (file)
@@ -736,7 +736,7 @@ PHP_FUNCTION(imagesetstyle)
 
        num_styles = zend_hash_num_elements(Z_ARRVAL_P(styles));
        if (num_styles == 0) {
-               zend_value_error("Styles array must not be empty");
+               zend_argument_value_error(2, "cannot be empty");
                RETURN_THROWS();
        }
 
@@ -767,12 +767,12 @@ PHP_FUNCTION(imagecreatetruecolor)
        }
 
        if (x_size <= 0 || x_size >= INT_MAX) {
-               zend_value_error("Invalid width (x_size)");
+               zend_argument_value_error(1, "must be greater than 0");
                RETURN_THROWS();
        }
 
        if (y_size <= 0 || y_size >= INT_MAX) {
-               zend_value_error("Invalid height (y_size)");
+               zend_argument_value_error(2, "must be greater than 0");
                RETURN_THROWS();
        }
 
@@ -819,7 +819,7 @@ PHP_FUNCTION(imagetruecolortopalette)
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
        if (ncolors <= 0 || ZEND_LONG_INT_OVFL(ncolors)) {
-               zend_value_error("Number of colors has to be greater than zero and no more than %d", INT_MAX);
+               zend_argument_value_error(3, "must be greater than 0 and less than %d", INT_MAX);
                RETURN_THROWS();
        }
 
@@ -1022,9 +1022,9 @@ PHP_FUNCTION(imagelayereffect)
 }
 /* }}} */
 
-#define CHECK_RGBA_RANGE(component, name) \
+#define CHECK_RGBA_RANGE(component, name, argument_number) \
        if (component < 0 || component > gd##name##Max) { \
-               zend_value_error(#name " component is out of range, must be between 0 and %d (inclusive)", gd##name##Max); \
+               zend_argument_value_error(argument_number, "must be between 0 and %d (inclusive)", gd##name##Max); \
                RETURN_THROWS(); \
        }
 
@@ -1043,10 +1043,10 @@ PHP_FUNCTION(imagecolorallocatealpha)
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
-       CHECK_RGBA_RANGE(alpha, Alpha);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
+       CHECK_RGBA_RANGE(alpha, Alpha, 5);
 
        ct = gdImageColorAllocateAlpha(im, red, green, blue, alpha);
        if (ct < 0) {
@@ -1070,10 +1070,10 @@ PHP_FUNCTION(imagecolorresolvealpha)
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
-       CHECK_RGBA_RANGE(alpha, Alpha);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
+       CHECK_RGBA_RANGE(alpha, Alpha, 5);
 
        RETURN_LONG(gdImageColorResolveAlpha(im, red, green, blue, alpha));
 }
@@ -1093,10 +1093,10 @@ PHP_FUNCTION(imagecolorclosestalpha)
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
-       CHECK_RGBA_RANGE(alpha, Alpha);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
+       CHECK_RGBA_RANGE(alpha, Alpha, 5);
 
        RETURN_LONG(gdImageColorClosestAlpha(im, red, green, blue, alpha));
 }
@@ -1110,16 +1110,16 @@ PHP_FUNCTION(imagecolorexactalpha)
        zend_long red, green, blue, alpha;
        gdImagePtr im;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce,  &red, &green, &blue, &alpha) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &red, &green, &blue, &alpha) == FAILURE) {
                RETURN_THROWS();
        }
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
-       CHECK_RGBA_RANGE(alpha, Alpha);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
+       CHECK_RGBA_RANGE(alpha, Alpha, 5);
 
        RETURN_LONG(gdImageColorExactAlpha(im, red, green, blue, alpha));
 }
@@ -1362,12 +1362,12 @@ PHP_FUNCTION(imagecreate)
        }
 
        if (x_size <= 0 || x_size >= INT_MAX) {
-               zend_value_error("Invalid width (x_size)");
+               zend_argument_value_error(1, "must be greater than 0");
                RETURN_THROWS();
        }
 
        if (y_size <= 0 || y_size >= INT_MAX) {
-               zend_value_error("Invalid height (y_size)");
+               zend_argument_value_error(2, "must be greater than 0");
                RETURN_THROWS();
        }
 
@@ -1601,12 +1601,12 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
                }
 
                if (width < 1) {
-                       zend_value_error("Width must be at least 1");
+                       zend_argument_value_error(4, "must be greater than or equal to 1");
                        RETURN_THROWS();
                }
 
                if (height < 1) {
-                       zend_value_error("Height must be at least 1");
+                       zend_argument_value_error(5, "must be greater than or equal to 1");
                        RETURN_THROWS();
                }
 
@@ -2023,9 +2023,9 @@ PHP_FUNCTION(imagecolorallocate)
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
 
        ct = gdImageColorAllocate(im, red, green, blue);
        if (ct < 0) {
@@ -2101,9 +2101,9 @@ PHP_FUNCTION(imagecolorclosest)
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
 
        RETURN_LONG(gdImageColorClosest(im, red, green, blue));
 }
@@ -2123,9 +2123,9 @@ PHP_FUNCTION(imagecolorclosesthwb)
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
 
        RETURN_LONG(gdImageColorClosestHWB(im, red, green, blue));
 }
@@ -2157,7 +2157,7 @@ PHP_FUNCTION(imagecolordeallocate)
                gdImageColorDeallocate(im, col);
                RETURN_TRUE;
        } else {
-               zend_value_error("Color index %d out of range", col);
+               zend_argument_value_error(2, "must be between 0 and %d", gdImageColorsTotal(im));
                RETURN_THROWS();
        }
 }
@@ -2177,9 +2177,9 @@ PHP_FUNCTION(imagecolorresolve)
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
 
        RETURN_LONG(gdImageColorResolve(im, red, green, blue));
 }
@@ -2199,9 +2199,9 @@ PHP_FUNCTION(imagecolorexact)
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
 
        RETURN_LONG(gdImageColorExact(im, red, green, blue));
 }
@@ -2222,10 +2222,9 @@ PHP_FUNCTION(imagecolorset)
 
        im = php_gd_libgdimageptr_from_zval_p(IM);
 
-       CHECK_RGBA_RANGE(red, Red);
-       CHECK_RGBA_RANGE(green, Green);
-       CHECK_RGBA_RANGE(blue, Blue);
-       CHECK_RGBA_RANGE(alpha, Alpha);
+       CHECK_RGBA_RANGE(red, Red, 2);
+       CHECK_RGBA_RANGE(green, Green, 3);
+       CHECK_RGBA_RANGE(blue, Blue, 4);
 
        col = color;
 
@@ -2284,8 +2283,13 @@ PHP_FUNCTION(imagegammacorrect)
                RETURN_THROWS();
        }
 
-       if ( input <= 0.0 || output <= 0.0 ) {
-               zend_value_error("Gamma values must be positive");
+       if (input <= 0.0) {
+               zend_argument_value_error(2, "must be greater than 0");
+               RETURN_THROWS();
+       }
+
+       if (output <= 0.0) {
+               zend_argument_value_error(3, "must be greater than 0");
                RETURN_THROWS();
        }
 
@@ -2594,7 +2598,7 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
                COL = NPOINTS;
                NPOINTS = zend_hash_num_elements(Z_ARRVAL_P(POINTS));
                if (NPOINTS % 2 != 0) {
-                       zend_value_error("Points array must have an even number of elements");
+                       zend_argument_value_error(2, "must have an even number of elements");
                        RETURN_THROWS();
                }
                NPOINTS /= 2;
@@ -2607,7 +2611,7 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
 
        nelem = zend_hash_num_elements(Z_ARRVAL_P(POINTS));
        if (npoints < 3) {
-               zend_value_error("Polygon must have at least 3 points");
+               zend_argument_value_error(3, "must be greater than or equal to 3");
                RETURN_THROWS();
        }
 
@@ -2983,8 +2987,23 @@ PHP_FUNCTION(imagecopyresized)
        dstH = DH;
        dstW = DW;
 
-       if (dstW <= 0 || dstH <= 0 || srcW <= 0 || srcH <= 0) {
-               zend_value_error("Invalid image dimensions");
+       if (dstW <= 0) {
+               zend_argument_value_error(3, "must be greater than 0");
+               RETURN_THROWS();
+       }
+
+       if (dstH <= 0) {
+               zend_argument_value_error(4, "must be greater than 0");
+               RETURN_THROWS();
+       }
+
+       if (srcW <= 0) {
+               zend_argument_value_error(5, "must be greater than 0");
+               RETURN_THROWS();
+       }
+
+       if (srcH <= 0) {
+               zend_argument_value_error(6, "must be greater than 0");
                RETURN_THROWS();
        }
 
@@ -3466,14 +3485,14 @@ PHP_FUNCTION(imageconvolution)
 
        nelem = zend_hash_num_elements(Z_ARRVAL_P(hash_matrix));
        if (nelem != 3) {
-               zend_value_error("Convolution matrix must be a 3x3 array");
+               zend_argument_value_error(2, "must be a 3x3 array");
                RETURN_THROWS();
        }
 
        for (i=0; i<3; i++) {
                if ((var = zend_hash_index_find(Z_ARRVAL_P(hash_matrix), (i))) != NULL && Z_TYPE_P(var) == IS_ARRAY) {
                        if (zend_hash_num_elements(Z_ARRVAL_P(var)) != 3 ) {
-                               zend_value_error("Convolution matrix must be a 3x3 array, matrix[%d] only has %d elements", i, zend_hash_num_elements(Z_ARRVAL_P(var)));
+                               zend_argument_value_error(2, "must be a 3x3 array, matrix[%d] only has %d elements", i, zend_hash_num_elements(Z_ARRVAL_P(var)));
                                RETURN_THROWS();
                        }
 
@@ -3481,7 +3500,7 @@ PHP_FUNCTION(imageconvolution)
                                if ((var2 = zend_hash_index_find(Z_ARRVAL_P(var), j)) != NULL) {
                                        matrix[i][j] = (float) zval_get_double(var2);
                                } else {
-                                       zend_value_error("Convolution matrix must be a 3x3 array, matrix[%d][%d] cannot be found (missing integer key)", i, j);
+                                       zend_argument_value_error(2, "must be a 3x3 array, matrix[%d][%d] cannot be found (missing integer key)", i, j);
                                        RETURN_THROWS();
                                }
                        }
@@ -3526,7 +3545,7 @@ PHP_FUNCTION(imageflip)
                        break;
 
                default:
-                       zend_value_error("Unknown flip mode");
+                       zend_argument_value_error(2, "must be a valid mode");
                        RETURN_THROWS();
        }
 
@@ -3575,28 +3594,28 @@ PHP_FUNCTION(imagecrop)
        if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "x", sizeof("x") -1)) != NULL) {
                rect.x = zval_get_long(tmp);
        } else {
-               zend_value_error("Cropping rectangle is missing x position");
+               zend_argument_value_error(2, "must have an 'x' key");
                RETURN_THROWS();
        }
 
        if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "y", sizeof("y") - 1)) != NULL) {
                rect.y = zval_get_long(tmp);
        } else {
-               zend_value_error("Cropping rectangle is missing y position");
+               zend_argument_value_error(2, "must have a 'y' key");
                RETURN_THROWS();
        }
 
        if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "width", sizeof("width") - 1)) != NULL) {
                rect.width = zval_get_long(tmp);
        } else {
-               zend_value_error("Cropping rectangle is missing width");
+               zend_argument_value_error(2, "must have a 'width' key");
                RETURN_THROWS();
        }
 
        if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "height", sizeof("height") - 1)) != NULL) {
                rect.height = zval_get_long(tmp);
        } else {
-               zend_value_error("Cropping rectangle is missing height");
+               zend_argument_value_error(2, "must have a 'height' key");
                RETURN_THROWS();
        }
 
@@ -3638,14 +3657,14 @@ PHP_FUNCTION(imagecropauto)
 
                case GD_CROP_THRESHOLD:
                        if (color < 0 || (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im))) {
-                               zend_value_error("Color argument missing with threshold mode");
+                               zend_argument_value_error(4, "must be greater than or equal to 0 when using the threshold mode");
                                RETURN_THROWS();
                        }
                        im_crop = gdImageCropThreshold(im, color, (float) threshold);
                        break;
 
                default:
-                       zend_value_error("Unknown crop mode");
+                       zend_argument_value_error(2, "must be a valid mode");
                        RETURN_THROWS();
        }
 
@@ -3762,28 +3781,28 @@ PHP_FUNCTION(imageaffine)
                if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "x", sizeof("x") - 1)) != NULL) {
                        rect.x = zval_get_long(tmp);
                } else {
-                       zend_value_error("Clip array is missing x position");
+                       zend_argument_value_error(3, "must have an 'x' key");
                        RETURN_THROWS();
                }
 
                if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "y", sizeof("y") - 1)) != NULL) {
                        rect.y = zval_get_long(tmp);
                } else {
-                       zend_value_error("Clip array is missing y position");
+                       zend_argument_value_error(3, "must have a 'y' key");
                        RETURN_THROWS();
                }
 
                if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "width", sizeof("width") - 1)) != NULL) {
                        rect.width = zval_get_long(tmp);
                } else {
-                       zend_value_error("Clip array is missing width");
+                       zend_argument_value_error(3, "must have a 'width' key");
                        RETURN_THROWS();
                }
 
                if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "height", sizeof("height") - 1)) != NULL) {
                        rect.height = zval_get_long(tmp);
                } else {
-                       zend_value_error("Clip array is missing height");
+                       zend_argument_value_error(3, "must have a 'height' key");
                        RETURN_THROWS();
                }
                pRect = &rect;
@@ -3827,14 +3846,14 @@ PHP_FUNCTION(imageaffinematrixget)
                        if ((tmp = zend_hash_str_find(Z_ARRVAL_P(options), "x", sizeof("x") - 1)) != NULL) {
                                x = zval_get_double(tmp);
                        } else {
-                               zend_value_error("Options array is missing x position");
+                               zend_argument_value_error(2, "must have an 'x' key");
                                RETURN_THROWS();
                        }
 
                        if ((tmp = zend_hash_str_find(Z_ARRVAL_P(options), "y", sizeof("y") - 1)) != NULL) {
                                y = zval_get_double(tmp);
                        } else {
-                               zend_value_error("Options array is missing y position");
+                               zend_argument_value_error(2, "must have a 'y' key");
                                RETURN_THROWS();
                        }
 
@@ -3894,14 +3913,19 @@ PHP_FUNCTION(imageaffinematrixconcat)
        zval *tmp;
        zval *z_m1;
        zval *z_m2;
-       int i, nelems;
+       int i;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa", &z_m1, &z_m2) == FAILURE)  {
                RETURN_THROWS();
        }
 
-       if (((nelems = zend_hash_num_elements(Z_ARRVAL_P(z_m1))) != 6) || (nelems = zend_hash_num_elements(Z_ARRVAL_P(z_m2))) != 6) {
-               zend_value_error("Affine arrays must have six elements");
+       if (zend_hash_num_elements(Z_ARRVAL_P(z_m1)) != 6) {
+               zend_argument_value_error(1, "must have 6 elements");
+               RETURN_THROWS();
+       }
+
+       if (zend_hash_num_elements(Z_ARRVAL_P(z_m2)) != 6) {
+               zend_argument_value_error(1, "must have 6 elements");
                RETURN_THROWS();
        }
 
index d69d604e5d7863b1bf7fe9fa5b5553e2101c4e0b..f316aed00b34302363432fb7a5dc2255b960efd9 100644 (file)
@@ -21,5 +21,5 @@ trycatch_dump(
 unlink($file);
 ?>
 --EXPECT--
-!! [ValueError] Width must be at least 1
-!! [ValueError] Height must be at least 1
+!! [ValueError] imagecreatefromgd2part(): Argument #4 ($width) must be greater than or equal to 1
+!! [ValueError] imagecreatefromgd2part(): Argument #5 ($height) must be greater than or equal to 1
index 8645989e09ee3d5f67d489d9ca89406d0ad29e09..311077141e5ee48d12e87e41e263d6ead09fbe32 100644 (file)
@@ -21,5 +21,5 @@ trycatch_dump(
 unlink($file);
 ?>
 --EXPECT--
-!! [ValueError] Width must be at least 1
-!! [ValueError] Height must be at least 1
+!! [ValueError] imagecreatefromgd2part(): Argument #4 ($width) must be greater than or equal to 1
+!! [ValueError] imagecreatefromgd2part(): Argument #5 ($height) must be greater than or equal to 1
index 38fb25db0778762bb3aec7b208ad649672107012..9b7044cee12dc789763b63605d2c123caa9dc0f4 100644 (file)
@@ -1,21 +1,21 @@
---TEST--\r
-Bug #55005 (imagepolygon num_points requirement)\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-?>\r
---FILE--\r
-<?php\r
-require_once __DIR__ . '/func.inc';\r
-\r
-$g = imagecreate(300, 300);\r
-$bgnd = imagecolorallocate($g, 255, 255, 255);\r
-$fgnd = imagecolorallocate($g, 0, 0, 0);\r
-trycatch_dump(\r
-    fn () => imagefilledpolygon($g, array(100,10, 100,100, 180,100), 2, $fgnd),\r
-    fn () => imagepolygon($g, array(200,10, 200,100, 280,100), 2, $fgnd)\r
-);\r
-?>\r
---EXPECTF--\r
-!! [ValueError] Polygon must have at least 3 points\r
-!! [ValueError] Polygon must have at least 3 points\r
+--TEST--
+Bug #55005 (imagepolygon num_points requirement)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . '/func.inc';
+
+$g = imagecreate(300, 300);
+$bgnd = imagecolorallocate($g, 255, 255, 255);
+$fgnd = imagecolorallocate($g, 0, 0, 0);
+trycatch_dump(
+    fn () => imagefilledpolygon($g, array(100,10, 100,100, 180,100), 2, $fgnd),
+    fn () => imagepolygon($g, array(200,10, 200,100, 280,100), 2, $fgnd)
+);
+?>
+--EXPECTF--
+!! [ValueError] imagefilledpolygon(): Argument #3 ($num_points_or_col) must be greater than or equal to 3
+!! [ValueError] imagepolygon(): Argument #3 ($num_points_or_col) must be greater than or equal to 3
index b01a19179a65fde709d64c91f8de50f954e7ee8c..97663cedf6035946f89c58659a4ffd2e7d762bdb 100644 (file)
@@ -16,4 +16,4 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Color argument missing with threshold mode
+!! [ValueError] imagecropauto(): Argument #4 ($color) must be greater than or equal to 0 when using the threshold mode
index 2c293d14be2640bafc02374f1399a935f73a1c31..369e5c6c83881fe1eaf848414ab363602cba8570 100644 (file)
@@ -19,5 +19,5 @@ trycatch_dump(
 ?>
 DONE
 --EXPECT--
-!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
+!! [ValueError] imagetruecolortopalette(): Argument #3 ($colorWanted) must be greater than 0 and less than 2147483647
 DONE
index a5b0463f6270fda3c438edd668de8bea553e299a..02df1bb7c7668f18196fd42df8f5754045be3068 100644 (file)
@@ -20,5 +20,5 @@ imagedestroy($im);
 ?>
 ====DONE====
 --EXPECT--
-Styles array must not be empty
+imagesetstyle(): Argument #2 ($styles) cannot be empty
 ====DONE====
index 09b6657adda697ad4ce3150489b41fd8b1affcb4..d021f70a4803b095fd2cbd5443d6c948ba30a413 100644 (file)
@@ -17,4 +17,4 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Gamma values must be positive
+!! [ValueError] imagegammacorrect(): Argument #2 ($inputgamma) must be greater than 0
index 1451af5a83bd714e5a2ec1bc314e2c685f7a5aea..bc7f82c84770336a57114b4afad0711f55a81f9f 100644 (file)
@@ -63,9 +63,9 @@ int(657930)
 int(657930)
 
 --Octal -012--
-!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #2 ($red) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #3 ($green) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #4 ($blue) must be between 0 and 255 (inclusive)
 
 --Octal 0377--
 int(16714250)
@@ -83,9 +83,9 @@ int(657930)
 int(657930)
 
 --Hexa-decimal -0xA--
-!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #2 ($red) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #3 ($green) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #4 ($blue) must be between 0 and 255 (inclusive)
 
 --Hexa-decimal 0xFF--
 int(16714250)
index 6af26801b82dbc8947429ce25edab213b0f2f1fa..355010d198b80de3aaed8c04ef00894814e1481f 100644 (file)
@@ -51,25 +51,25 @@ foreach($values as $key => $value) {
 *** Testing imagecolorallocate() : usage variations ***
 
 --Decimal 256--
-!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #2 ($red) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #2 ($red) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #3 ($green) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #3 ($green) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #4 ($blue) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #4 ($blue) must be between 0 and 255 (inclusive)
 
 --Octal 0400--
-!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #2 ($red) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #2 ($red) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #3 ($green) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #3 ($green) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #4 ($blue) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #4 ($blue) must be between 0 and 255 (inclusive)
 
 --Hexa-decimal 0x100--
-!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
-!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #2 ($red) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #2 ($red) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #3 ($green) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #3 ($green) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #4 ($blue) must be between 0 and 255 (inclusive)
+!! [ValueError] imagecolorallocate(): Argument #4 ($blue) must be between 0 and 255 (inclusive)
index e0748c44baa7a20068be02ecbb4e384e209bd322..51df328f8c835c649fa635c02b4dffbe8acf9b4c 100644 (file)
@@ -22,4 +22,4 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Color index 101 out of range
+!! [ValueError] imagecolordeallocate(): Argument #2 ($index) must be between 0 and 1
index e35c529879fb361d16f87ffda4db24ca978306a9..6d9bceb3ac91f8e0c7c72aba4b72ae29d7164844 100644 (file)
@@ -22,4 +22,4 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Color index -1 out of range
+!! [ValueError] imagecolordeallocate(): Argument #2 ($index) must be between 0 and 1
index d26851c26cf1969f5e9ff8948fec5cc367daceca..b9c32af1e440816965132bcd2ac2595abd5eed91 100644 (file)
@@ -27,4 +27,4 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Convolution matrix must be a 3x3 array
+!! [ValueError] imageconvolution(): Argument #2 ($matrix3x3) must be a 3x3 array
index 8974fdbda0f298656a3c4b3bc6efe83b3c88ab9f..2ad99f961782e4e7e243451359041ecdee4876da 100644 (file)
@@ -35,5 +35,5 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Convolution matrix must be a 3x3 array, matrix[2] only has 2 elements
-!! [ValueError] Convolution matrix must be a 3x3 array, matrix[2][2] cannot be found (missing integer key)
+!! [ValueError] imageconvolution(): Argument #2 ($matrix3x3) must be a 3x3 array, matrix[2] only has 2 elements
+!! [ValueError] imageconvolution(): Argument #2 ($matrix3x3) must be a 3x3 array, matrix[2][2] cannot be found (missing integer key)
index 9fd8679c135a46691132d5f104d0ad9cc960ec1e..b0b6c3abf7e947e87d6b706c54a54698f8e7fd49 100644 (file)
@@ -17,5 +17,5 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Invalid width (x_size)
-!! [ValueError] Invalid height (y_size)
+!! [ValueError] imagecreate(): Argument #1 ($x_size) must be greater than 0
+!! [ValueError] imagecreate(): Argument #2 ($y_size) must be greater than 0
index e2784b15307ff95f194817ae4149b8dd712a50cf..995aa03d7ed02cec1f4750edfd2c6bd14a0312e4 100644 (file)
@@ -19,5 +19,5 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Invalid width (x_size)
-!! [ValueError] Invalid height (y_size)
+!! [ValueError] imagecreatetruecolor(): Argument #1 ($x_size) must be greater than 0
+!! [ValueError] imagecreatetruecolor(): Argument #2 ($y_size) must be greater than 0
index 40dc30611662f5e2db2d5535b4e9081d5621846f..707f7e37bce148b6b4be17ba3a4b567ad6e633f9 100644 (file)
@@ -19,4 +19,4 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
+!! [ValueError] imagetruecolortopalette(): Argument #3 ($colorWanted) must be greater than 0 and less than 2147483647
index 055fc657b2ba1ff99dc49788e559cf2e00d6e371..5726befab25a368eacb4ae28dea094dd68aa8152 100644 (file)
@@ -20,5 +20,5 @@ trycatch_dump(
 
 ?>
 --EXPECT--
-!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
-!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
+!! [ValueError] imagetruecolortopalette(): Argument #3 ($colorWanted) must be greater than 0 and less than 2147483647
+!! [ValueError] imagetruecolortopalette(): Argument #3 ($colorWanted) must be greater than 0 and less than 2147483647
index b78de3ea16bc3b833245f966ed400a72191a22cd..c64378fd565ded1031fb4b9721cc76ee96d38fb0 100644 (file)
@@ -299,12 +299,12 @@ PHP_FUNCTION(json_decode)
        }
 
        if (depth <= 0) {
-               zend_value_error("Depth must be greater than zero");
+               zend_argument_value_error(3, "must be greater than 0");
                RETURN_THROWS();
        }
 
        if (depth > INT_MAX) {
-               zend_value_error("Depth must be lower than %d", INT_MAX);
+               zend_argument_value_error(3, "must be less than %d", INT_MAX);
                RETURN_THROWS();
        }
 
index d2d1f8017716d472c905b7906c7e56adcbaad919..48983b0fb7055c1609a6758cca60d0dcba73fc35 100644 (file)
@@ -14,4 +14,4 @@ try {
 
 ?>
 --EXPECTF--
-Depth must be lower than %d
+json_decode(): Argument #3 ($depth) must be less than %d
index b286df8e744694e44276b2ee02eb192f4d835653..36d86168cd2dabf853ac6f3d715a0828fb82cb97 100644 (file)
@@ -19,4 +19,4 @@ try {
 *** Testing json_decode() : error conditions ***
 
 -- Testing json_decode() function with depth below 0 --
-Depth must be greater than zero
+json_decode(): Argument #3 ($depth) must be greater than 0
index 0d5fc6de081a54327090169c71de5c3680cb24d1..18dddd962d17fe5b97deed7e0f01d5ab0c5f794d 100644 (file)
@@ -1299,7 +1299,7 @@ PHP_METHOD(sqlite3, openBlob)
        }
 
        if (ZEND_NUM_ARGS() >= 4 && CHECK_NULL_PATH(dbname, dbname_len)) {
-               zend_value_error("dbname must not contain null bytes");
+               zend_argument_type_error(4, "must not contain null bytes");
                RETURN_THROWS();
        }
 
@@ -1405,10 +1405,13 @@ PHP_METHOD(sqlite3, backup)
                RETURN_THROWS();
        }
 
-       if ((ZEND_NUM_ARGS() >= 2 && CHECK_NULL_PATH(source_dbname, source_dbname_length))
-               || (ZEND_NUM_ARGS() >= 3 && CHECK_NULL_PATH(destination_dbname, destination_dbname_length))
-       ) {
-               zend_value_error("dbname must not contain null bytes");
+       if (ZEND_NUM_ARGS() >= 2 && CHECK_NULL_PATH(source_dbname, source_dbname_length)) {
+               zend_argument_type_error(2, "must not contain null bytes");
+               RETURN_THROWS();
+       }
+
+       if (ZEND_NUM_ARGS() >= 3 && CHECK_NULL_PATH(destination_dbname, destination_dbname_length)) {
+               zend_argument_type_error(3, "must not contain null bytes");
                RETURN_THROWS();
        }
 
index 17c7f29d9a31deff63039303ac1e1e6fa9b1bc9d..daecdc7a52e329fd9ffe200ac3c0bdd3487fb9ff 100644 (file)
@@ -704,7 +704,7 @@ PHP_FUNCTION(count)
        ZEND_PARSE_PARAMETERS_END();
 
        if (mode != COUNT_NORMAL && mode != COUNT_RECURSIVE) {
-               zend_value_error("Mode value is invalid");
+               zend_argument_value_error(2, "must be a valid mode");
                RETURN_THROWS();
        }
 
@@ -2385,12 +2385,12 @@ PHP_FUNCTION(extract)
        extract_type &= 0xff;
 
        if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {
-               zend_value_error("Invalid extract type");
+               zend_argument_value_error(2, "must be a valid extract type");
                RETURN_THROWS();
        }
 
        if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS && ZEND_NUM_ARGS() < 3) {
-               zend_value_error("Specified extract type requires the prefix parameter");
+               zend_argument_value_error(3, "is required when using this extract type");
                RETURN_THROWS();
        }
 
index 1995ec1da8b6cb61f160f6c9faa957a28679cb96..b039c169afdd1a70d968ec2b999f292cb48c0d04 100644 (file)
@@ -314,7 +314,7 @@ PHP_FUNCTION(assert_options)
                break;
 
        default:
-               zend_value_error("Unknown value " ZEND_LONG_FMT, what);
+               zend_argument_value_error(1, "must have a valid value");
                break;
        }
 
index d99b7fb498603959aded57e4450d1e52625270f3..8596ce4a507f15e1089400d1fd74e36227e06ac6 100755 (executable)
@@ -850,7 +850,7 @@ PHP_FUNCTION(putenv)
        ZEND_PARSE_PARAMETERS_END();
 
        if (setting_len == 0 || setting[0] == '=') {
-               zend_value_error("Invalid parameter syntax");
+               zend_argument_value_error(1, "must have a valid syntax");
                RETURN_THROWS();
        }
 
index 535c536b72a85b0ce3540b0333c8841974e42661..0eaadac3e49a879885d7b5ddcb76882bfa42404b 100644 (file)
@@ -559,7 +559,7 @@ PHP_FUNCTION(scandir)
        ZEND_PARSE_PARAMETERS_END();
 
        if (dirn_len < 1) {
-               zend_value_error("Directory name cannot be empty");
+               zend_argument_value_error(1, "cannot be empty");
                RETURN_THROWS();
        }
 
index c566f4e6ae4ab6e473fdb96fe7459fbf5aedc8b8..c6160aa9e6ff50d3161101c65199781de3f367f8 100644 (file)
@@ -381,7 +381,7 @@ PHP_FUNCTION(dns_check_record)
        ZEND_PARSE_PARAMETERS_END();
 
        if (hostname_len == 0) {
-               zend_value_error("Host cannot be empty");
+               zend_argument_value_error(1, "cannot be empty");
                RETURN_THROWS();
        }
 
index b1cf4986fda1599116fcf8efd48b24783593b357..4572a84b0505e1acbfb9f95969723f0762951663 100644 (file)
@@ -107,7 +107,7 @@ PHP_FUNCTION(dns_check_record)
        }
 
        if (hostname_len == 0) {
-               zend_value_error("Host cannot be empty");
+               zend_argument_value_error(1, "cannot be empty");
                RETURN_THROWS();
        }
 
index 7639b201112bf373aa76987e5c11d6633e2adb5d..5cde0ef978152c2d4694a980dfd5ec2d628b0eac 100644 (file)
@@ -742,7 +742,7 @@ PHP_FUNCTION(file)
        ZEND_PARSE_PARAMETERS_END();
 
        if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) {
-               zend_value_error("'" ZEND_LONG_FMT "' flag is not supported", flags);
+               zend_argument_value_error(2, "must be a valid flag value");
                RETURN_THROWS();
        }
 
@@ -1492,7 +1492,7 @@ PHP_FUNCTION(ftruncate)
        ZEND_PARSE_PARAMETERS_END();
 
        if (size < 0) {
-               zend_value_error("Negative size is not supported");
+               zend_argument_value_error(2, "must be greater than or equal to 0");
                RETURN_THROWS();
        }
 
index 6e302fd0ce9a8e71a9f1905bd7554284db7e1455..a411a2983ed5b72903a543355453bcae0fc62110 100644 (file)
@@ -29,9 +29,9 @@ int(0)
 int(0)
 int(0)
 int(0)
-Mode value is invalid
-Mode value is invalid
-Mode value is invalid
+count(): Argument #2 ($mode) must be a valid mode
+count(): Argument #2 ($mode) must be a valid mode
+count(): Argument #2 ($mode) must be a valid mode
 int(0)
 int(0)
 int(0)
index db6569e94c48003e8b78a1eb5506d35e15b32c49..40f517fb4d7ed0e9db6378bdc440dedae0460220 100644 (file)
@@ -33,6 +33,6 @@ try {
 *** Testing Error Conditions ***
 
 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
+extract(): Argument #2 ($extract_type) must be a valid extract type
+extract(): Argument #2 ($extract_type) must be a valid extract type
+extract(): Argument #3 ($prefix) is required when using this extract type
index ed94260ef832e655eaa1638a51c86303670c25b1..ba9286773730750a026e6d39798cc13ad9cabb03 100644 (file)
@@ -10,4 +10,4 @@ try {
 }
 ?>
 --EXPECT--
-Unknown value 1000
+assert_options(): Argument #1 ($what) must have a valid value
index 2f9fcabb9addc3b727db2dbaf4985c482687a5c8..2c779bedcd41f2c7e8e62e9de933b4a4f24a778c 100644 (file)
@@ -11,4 +11,4 @@ try {
 
 ?>
 --EXPECT--
-Directory name cannot be empty
+scandir(): Argument #1 ($directory) cannot be empty
index 7d3b911109b9747b90a5f49eae4373b1c00faa1f..68f98f19b6a842bf5dba88f3462dd05d18ac1455 100644 (file)
@@ -10,4 +10,4 @@ try {
 }
 ?>
 --EXPECT--
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
index e5d8b6d51a0d096d14f8b2e41e019a65304fb7a7..354f6ee509c7bb2b0dcad71a2a98c3754f525746 100644 (file)
@@ -236,12 +236,12 @@ array(3) {
   [2]=>
   string(6) "Line 3"
 }
-'24' flag is not supported
-'25' flag is not supported
-'26' flag is not supported
-'27' flag is not supported
-'28' flag is not supported
-'29' flag is not supported
-'30' flag is not supported
-'31' flag is not supported
-'32' flag is not supported
\ No newline at end of file
+file(): Argument #2 ($flags) must be a valid flag value
+file(): Argument #2 ($flags) must be a valid flag value
+file(): Argument #2 ($flags) must be a valid flag value
+file(): Argument #2 ($flags) must be a valid flag value
+file(): Argument #2 ($flags) must be a valid flag value
+file(): Argument #2 ($flags) must be a valid flag value
+file(): Argument #2 ($flags) must be a valid flag value
+file(): Argument #2 ($flags) must be a valid flag value
+file(): Argument #2 ($flags) must be a valid flag value
index 74790e687c510bdea8a78f9354cd8a5cb08af361..7006740e4c34b420788f408f424cb214fdd48188 100644 (file)
@@ -63,5 +63,5 @@ bool(true)
 int(1200)
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
index d5d883b1a1b310db179a79d16a4ceb2100bb6fd4..757bbb733d03a86ac8d5c74752a8b6dd82517a49 100644 (file)
Binary files a/ext/standard/tests/file/ftruncate.phpt and b/ext/standard/tests/file/ftruncate.phpt differ
index 95ae439b4db1c7f3e462d3c27fc924b6c34c1b45..87fc7b3524fda59570c1769e87811fe8017f0018 100644 (file)
@@ -77,7 +77,7 @@ echo "Done\n";
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -85,7 +85,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -93,7 +93,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -101,7 +101,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -109,7 +109,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -117,7 +117,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -125,7 +125,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -133,7 +133,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -141,7 +141,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -149,7 +149,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -157,7 +157,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -165,7 +165,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -173,7 +173,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -181,7 +181,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -189,7 +189,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -197,7 +197,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -205,7 +205,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -213,7 +213,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -221,7 +221,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -229,7 +229,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -237,7 +237,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -245,7 +245,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -253,7 +253,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -261,7 +261,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -271,7 +271,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -279,7 +279,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -287,7 +287,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -295,7 +295,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -303,7 +303,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -311,7 +311,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -319,7 +319,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -327,7 +327,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -335,7 +335,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -343,7 +343,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -351,7 +351,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -359,7 +359,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -367,7 +367,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -375,7 +375,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -383,7 +383,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -391,7 +391,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -399,7 +399,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -407,7 +407,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -415,7 +415,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -423,7 +423,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -431,7 +431,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -439,7 +439,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -447,7 +447,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
@@ -455,7 +455,7 @@ bool(true)
 -- Testing ftruncate(): try truncating file to a negative size --
 bool(true)
 int(0)
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 int(0)
 bool(false)
 bool(true)
index 5650df2aa01a9acd1590b5da124f5adef436ecda..e553e1c8eeb71eebe495ac5034322140e2ba2cdd 100644 (file)
@@ -59,7 +59,7 @@ bool(true)
 truncation with new_size=10
 bool(true)
 ------ stream_truncate negative size: -------
-Negative size is not supported
+ftruncate(): Argument #2 ($size) must be greater than or equal to 0
 ------ stream_truncate bad return: -------
 truncation with new_size=0
 
index c1f4f98eeb565b5191e72bfb2f0d71efb5ddd2bc..163fa7e4a708e7c1164000a9780b6b5e889a0c7b 100644 (file)
@@ -29,7 +29,7 @@ try {
 
 echo "Done\n";
 ?>
---EXPECTF--
+--EXPECT--
 bool(false)
 bool(true)
 string(5) "value"
@@ -37,6 +37,6 @@ bool(true)
 string(0) ""
 bool(true)
 bool(false)
-Invalid parameter syntax
-Invalid parameter syntax
+putenv(): Argument #1 ($setting) must have a valid syntax
+putenv(): Argument #1 ($setting) must have a valid syntax
 Done
index 6390327a52bef24d59262e2cecb1857b902aeb7b..626561976b845ab94afec5278f14a8f7d1991aa5 100644 (file)
@@ -9,4 +9,4 @@ try {
 }
 ?>
 --EXPECT--
-Host cannot be empty
+dns_check_record(): Argument #1 ($hostname) cannot be empty