]> granicus.if.org Git - php/commitdiff
Improve error messages of various extensions
authorMáté Kocsis <kocsismate@woohoolabs.com>
Wed, 18 Mar 2020 21:44:02 +0000 (22:44 +0100)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Mon, 23 Mar 2020 17:59:04 +0000 (18:59 +0100)
Closes GH-5278

29 files changed:
ext/bz2/bz2.c
ext/bz2/tests/002.phpt
ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt
ext/dom/parentnode.c
ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt
ext/gd/gd.c
ext/gd/tests/bug67248.phpt
ext/gd/tests/imagebmp_nullbyte_injection.phpt
ext/gd/tests/imagegif_nullbyte_injection.phpt
ext/gd/tests/imagejpeg_nullbyte_injection.phpt
ext/gd/tests/imagepng_nullbyte_injection.phpt
ext/gd/tests/imagewbmp_nullbyte_injection.phpt
ext/gd/tests/imagewebp_nullbyte_injection.phpt
ext/mysqli/mysqli.c
ext/openssl/openssl.c
ext/openssl/tests/openssl_random_pseudo_bytes_error.phpt
ext/pcre/php_pcre.c
ext/pcre/tests/bug21732.phpt
ext/pcre/tests/preg_replace_error2.phpt
ext/pdo/pdo_dbh.c
ext/pdo_mysql/tests/pdo_mysql___construct.phpt
ext/simplexml/simplexml.c
ext/simplexml/tests/bug74950.phpt
ext/snmp/snmp.c
ext/snmp/tests/snmp-object-error.phpt
ext/spl/php_spl.c
ext/spl/tests/class_implements_variation1.phpt
ext/spl/tests/class_uses_variation1.phpt
ext/zlib/zlib.c

index c90c117d713b3e7b6aad13a7cf3d3d1a8a5feea8..005520c2ad01808a5a93df0607efbefac3161a3e 100644 (file)
@@ -379,7 +379,7 @@ static PHP_FUNCTION(bzopen)
                }
 
                if (CHECK_ZVAL_NULL_PATH(file)) {
-                       zend_type_error("Filename must not contain null bytes");
+                       zend_argument_type_error(1, "must not contain null bytes");
                        RETURN_THROWS();
                }
 
@@ -430,7 +430,7 @@ static PHP_FUNCTION(bzopen)
 
                stream = php_stream_bz2open_from_BZFILE(bz, mode, stream);
        } else {
-               zend_type_error("First parameter has to be string or file-resource");
+               zend_argument_type_error(1, "must be of type string or file-resource, %s given", zend_zval_type_name(file));
                RETURN_THROWS();
        }
 
index 78c4a9bbdfdeea67b8190499ba33be4a1356ca80..9a7f7f085509187460b404e31f0d0e61c3363c7f 100644 (file)
@@ -91,10 +91,10 @@ resource(%d) of type (stream)
 resource(%d) of type (stream)
 
 Warning: fopen(bz_open_002.txt): Failed to open stream: Bad file %s in %s on line %d
-First parameter has to be string or file-resource
+bzopen(): Argument #1 ($file) must be of type string or file-resource, bool given
 
 Warning: fopen(bz_open_002.txt): Failed to open stream: Bad file %s in %s on line %d
-First parameter has to be string or file-resource
+bzopen(): Argument #1 ($file) must be of type string or file-resource, bool given
 
 Warning: bzopen(): cannot write to a stream opened in read only mode in %s on line %d
 bool(false)
index 9a05015bb985666c43de63dc8862a1c4f270948a..1261981c6bef9810b50591c9d3c650893d9d4723 100644 (file)
@@ -7,17 +7,17 @@ bzopen(): throw TypeError if filename contains null bytes
 
 try {
     bzopen("file\0", "w");
-} catch (\TypeError $e) {
+} catch (TypeError $e) {
     echo $e->getMessage() . \PHP_EOL;
 }
 
 try {
     bzopen("file\0", "r");
-} catch (\TypeError $e) {
+} catch (TypeError $e) {
     echo $e->getMessage() . \PHP_EOL;
 }
 
 ?>
 --EXPECT--
-Filename must not contain null bytes
-Filename must not contain null bytes
+bzopen(): Argument #1 ($file) must not contain null bytes
+bzopen(): Argument #1 ($file) must not contain null bytes
index a9502a51590ca7f76bba74553e80d6cd6cca6db4..0e7b49ef4ecdb13bbb17eeaa680ba5cb13bdf65f 100644 (file)
@@ -197,7 +197,7 @@ xmlNode* dom_zvals_to_fragment(php_libxml_ref_obj *document, xmlNode *contextNod
                        } else {
                                xmlFree(fragment);
 
-                               zend_type_error("Invalid argument type must be either DOMNode or string");
+                               zend_argument_type_error(i + 1, "must be of type DOMNode|string, %s given", zend_zval_type_name(&nodes[i]));
                                return NULL;
                        }
                } else if (Z_TYPE(nodes[i]) == IS_STRING) {
@@ -213,7 +213,7 @@ xmlNode* dom_zvals_to_fragment(php_libxml_ref_obj *document, xmlNode *contextNod
                } else {
                        xmlFree(fragment);
 
-                       zend_type_error("Invalid argument type must be either DOMNode or string");
+                       zend_argument_type_error(i + 1, "must be of type DOMNode|string, %s given", zend_zval_type_name(&nodes[i]));
 
                        return NULL;
                }
index ab715caaa007f723dbe88708bfbd6fef2c12de64..8e58f35a3e1b964ab23e3302d288dc42b883cf59 100644 (file)
@@ -15,4 +15,4 @@ try {
     echo "OK! {$e->getMessage()}";
 }
 --EXPECT--
-OK! Invalid argument type must be either DOMNode or string
+OK! DOMElement::append(): Argument #1 must be of type DOMNode|string, array given
index 1775ae46276cff707acb227138827404cd2f4a12..8435d765b6f3a5fcf1fb9e54ac1d9ccb202b13a3 100644 (file)
@@ -3885,7 +3885,7 @@ PHP_FUNCTION(imageaffine)
        src = php_gd_libgdimageptr_from_zval_p(IM);
 
        if ((nelems = zend_hash_num_elements(Z_ARRVAL_P(z_affine))) != 6) {
-               zend_value_error("Affine array must have six elements");
+               zend_argument_value_error(2, "must have 6 elements");
                RETURN_THROWS();
        }
 
@@ -3902,7 +3902,7 @@ PHP_FUNCTION(imageaffine)
                                        affine[i] = zval_get_double(zval_affine_elem);
                                        break;
                                default:
-                                       zend_type_error("Invalid type for element %i", i);
+                                       zend_argument_type_error(3, "contains invalid type for element %i", i);
                                        RETURN_THROWS();
                        }
                }
@@ -3970,7 +3970,7 @@ PHP_FUNCTION(imageaffinematrixget)
                case GD_AFFINE_SCALE: {
                        double x, y;
                        if (!options || Z_TYPE_P(options) != IS_ARRAY) {
-                               zend_type_error("Array expected as options when using translate or scale");
+                               zend_argument_type_error(1, "must be of type array when using translate or scale");
                                RETURN_THROWS();
                        }
 
@@ -4002,7 +4002,7 @@ PHP_FUNCTION(imageaffinematrixget)
                        double angle;
 
                        if (!options) {
-                               zend_type_error("Number is expected as option when using rotate or shear");
+                               zend_argument_type_error(2, "must be of type int|double when using rotate or shear");
                                RETURN_THROWS();
                        }
 
@@ -4019,7 +4019,7 @@ PHP_FUNCTION(imageaffinematrixget)
                }
 
                default:
-                       zend_value_error("Invalid type for element " ZEND_LONG_FMT, type);
+                       zend_argument_value_error(1, "must be a valid element type");
                        RETURN_THROWS();
        }
 
@@ -4068,7 +4068,7 @@ PHP_FUNCTION(imageaffinematrixconcat)
                                        m1[i] = zval_get_double(tmp);
                                        break;
                                default:
-                                       zend_type_error("Matrix 1 contains invalid type for element %i", i);
+                                       zend_argument_type_error(1, "contains invalid type for element %i", i);
                                        RETURN_THROWS();
                        }
                }
@@ -4085,7 +4085,7 @@ PHP_FUNCTION(imageaffinematrixconcat)
                                        m2[i] = zval_get_double(tmp);
                                        break;
                                default:
-                                       zend_type_error("Matrix 2 contains invalid type for element %i", i);
+                                       zend_argument_type_error(2, "contains invalid type for element %i", i);
                                        RETURN_THROWS();
                        }
                }
@@ -4299,7 +4299,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
                        close_stream = 0;
                } else if (Z_TYPE_P(to_zval) == IS_STRING) {
                        if (CHECK_ZVAL_NULL_PATH(to_zval)) {
-                               zend_type_error("Invalid 2nd parameter, filename must not contain null bytes");
+                               zend_argument_type_error(2, "must not contain null bytes");
                                RETURN_THROWS();
                        }
 
index c5b54354f140756fb2a1fb5ad6567ecc4833e24b..b54a20ba8e3368104bde9b7893608891a1cdb8cf 100644 (file)
@@ -16,10 +16,10 @@ for($i=0;$i<7;$i++) {
 }
 ?>
 --EXPECT--
-!! [TypeError] Array expected as options when using translate or scale
-!! [TypeError] Array expected as options when using translate or scale
-!! [TypeError] Number is expected as option when using rotate or shear
-!! [TypeError] Number is expected as option when using rotate or shear
-!! [TypeError] Number is expected as option when using rotate or shear
-!! [ValueError] Invalid type for element 5
-!! [ValueError] Invalid type for element 6
+!! [TypeError] imageaffinematrixget(): Argument #1 ($type) must be of type array when using translate or scale
+!! [TypeError] imageaffinematrixget(): Argument #1 ($type) must be of type array when using translate or scale
+!! [TypeError] imageaffinematrixget(): Argument #2 ($options) must be of type int|double when using rotate or shear
+!! [TypeError] imageaffinematrixget(): Argument #2 ($options) must be of type int|double when using rotate or shear
+!! [TypeError] imageaffinematrixget(): Argument #2 ($options) must be of type int|double when using rotate or shear
+!! [ValueError] imageaffinematrixget(): Argument #1 ($type) must be a valid element type
+!! [ValueError] imageaffinematrixget(): Argument #1 ($type) must be a valid element type
index 00d0a7168c7f0f4b599b35fa4a6914d222fa99ea..9f0398b5da9d0f80c41acd49e4107341bf114749 100644 (file)
@@ -15,4 +15,4 @@ try {
 }
 ?>
 --EXPECT--
-Invalid 2nd parameter, filename must not contain null bytes
+imagebmp(): Argument #2 ($to) must not contain null bytes
index 4518ecad2737d2274e1bfaf910fa54f9f5b577a6..4b164392c218d78acc68a935d02f99acd3eaedf0 100644 (file)
@@ -14,4 +14,4 @@ try {
 }
 ?>
 --EXPECT--
-Invalid 2nd parameter, filename must not contain null bytes
+imagegif(): Argument #2 ($to) must not contain null bytes
index 1a7f6da03c0c16f420af141e593aa6f4ef2618a1..2f175271d158b785b133c7362d7f2f61e45b30fe 100644 (file)
@@ -18,4 +18,4 @@ try {
 }
 ?>
 --EXPECT--
-Invalid 2nd parameter, filename must not contain null bytes
+imagejpeg(): Argument #2 ($to) must not contain null bytes
index 86d614ab60fe5e312852893784c307ea278e15dc..bd98a97dabb586b86383554d4546f542ddc48153 100644 (file)
@@ -18,4 +18,4 @@ try {
 }
 ?>
 --EXPECTF--
-Invalid 2nd parameter, filename must not contain null bytes
+imagepng(): Argument #2 ($to) must not contain null bytes
index cce38a63dffc7f25798aef5ba8697c97e1103d3a..8f2bdcec5951ea434b4ce8597260ec9d85f34e5b 100644 (file)
@@ -18,4 +18,4 @@ try {
 }
 ?>
 --EXPECT--
-Invalid 2nd parameter, filename must not contain null bytes
+imagewbmp(): Argument #2 ($to) must not contain null bytes
index 82e45aca02459207e2065ca0644f66237ed48492..c48fd7d821fd04fcc6a92ef21265b162b259ab96 100644 (file)
@@ -18,4 +18,4 @@ try {
 }
 ?>
 --EXPECT--
-Invalid 2nd parameter, filename must not contain null bytes
+imagewebp(): Argument #2 ($to) must not contain null bytes
index cbfbb451bc94662872fc4ae8b9919cf919813081..5d5413a5936c5201da7e7b2128d2206ed5ad8ba9 100644 (file)
@@ -1272,7 +1272,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
                                         * single value is an array. Also we'd have to make that one
                                         * argument passed by reference.
                                         */
-                                       zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0);
+                                       zend_argument_error(zend_ce_exception, 3, "must be of type array, %s given", zend_zval_type_name(ctor_params));
                                        RETURN_THROWS();
                                }
                        }
index 62263d2f7e2e6ef4fc5a640eca98f18d58fc6770..a7d65dd4309535426839ad574fbcdb17adbd0476 100644 (file)
@@ -6640,7 +6640,7 @@ PHP_OPENSSL_API zend_string* php_openssl_random_pseudo_bytes(zend_long buffer_le
                || ZEND_LONG_INT_OVFL(buffer_length)
 #endif
                        ) {
-               zend_throw_exception(zend_ce_error, "Length must be greater than 0", 0);
+               zend_argument_error(NULL, 1, "must be greater than 0");
                return NULL;
        }
        buffer = zend_string_alloc(buffer_length, 0);
index ee3f1d032cd48162a7de46c69fc1bea7694a3aff..17bf181f1731e137a0a2e4c440cb4969259087d1 100644 (file)
@@ -11,4 +11,4 @@ try {
 }
 ?>
 --EXPECT--
-Length must be greater than 0
+openssl_random_pseudo_bytes(): Argument #1 ($length) must be greater than 0
index fdc1b1b8563ad91bd7bb50b928dfe80224923a57..fc98542ef93c8237af61bb7df7e5a5c496bd4ffb 100644 (file)
@@ -2303,7 +2303,7 @@ static void preg_replace_common(INTERNAL_FUNCTION_PARAMETERS, int is_filter)
                }
        } else {
                if (Z_TYPE_P(regex) != IS_ARRAY) {
-                       zend_type_error("Parameter mismatch, pattern is a string while replacement is an array");
+                       zend_argument_type_error(1, "must be of type array when argument #2 ($replace) is an array, %s given", zend_zval_type_name(regex));
                        RETURN_THROWS();
                }
        }
index a88d36c94c75d0cff3d9d960f62e95b3a36f0c19..6d162d159bcb783b9bfedd974ac22b1866fa4bc6 100644 (file)
@@ -17,7 +17,7 @@ try {
 var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde'));
 ?>
 --EXPECT--
-Parameter mismatch, pattern is a string while replacement is an array
+preg_replace(): Argument #1 ($regex) must be of type array when argument #2 ($replace) is an array, string given
 array(4) {
   [0]=>
   string(5) "abcde"
index eeff2fae54593bf42b5259b28cdad7ac3f9f8f02..2401e0bb4987ef6385110ef884cb6e9d363a4065 100644 (file)
@@ -36,6 +36,6 @@ Arg value is: this is a string
 string(64) "this is a stringthis is a stringthis is a stringthis is a string"
 
 Arg value is: Array
-Parameter mismatch, pattern is a string while replacement is an array
+preg_replace(): Argument #1 ($regex) must be of type array when argument #2 ($replace) is an array, string given
 Object of class stdClass could not be converted to string
 Done
index 9a1e0f53f66f3f891f4ac40ac6eea6b3f4efc99f..c6b18b249b5b2c9d11c7d32e7cdc85525752212c 100644 (file)
@@ -225,7 +225,7 @@ static PHP_METHOD(PDO, dbh_constructor)
 
                snprintf(alt_dsn, sizeof(alt_dsn), "pdo.dsn.%s", data_source);
                if (FAILURE == cfg_get_string(alt_dsn, &ini_dsn)) {
-                       zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source name");
+                       zend_argument_error(php_pdo_get_exception(), 1, "must be a valid data source name");
                        RETURN_THROWS();
                }
 
@@ -242,12 +242,12 @@ static PHP_METHOD(PDO, dbh_constructor)
                /* the specified URI holds connection details */
                data_source = dsn_from_uri(data_source + sizeof("uri:")-1, alt_dsn, sizeof(alt_dsn));
                if (!data_source) {
-                       zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source URI");
+                       zend_argument_error(php_pdo_get_exception(), 1, "must be a valid data source URI");
                        RETURN_THROWS();
                }
                colon = strchr(data_source, ':');
                if (!colon) {
-                       zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source name (via URI)");
+                       zend_argument_error(php_pdo_get_exception(), 1, "must be a valid data source name (via URI)");
                        RETURN_THROWS();
                }
        }
index 2231f8b44936a370a148b76d2ab3a743960fa0e5..7412402125d1f47da72df780f633ff62bb66f73f 100644 (file)
@@ -293,11 +293,11 @@ MySQLPDOTest::skip();
     print "done!";
 ?>
 --EXPECTF--
-[002] invalid data source name, [n/a] n/a
-[003] invalid data source name, [n/a] n/a
-[004] invalid data source name, [n/a] n/a
-[005] invalid data source name, [n/a] n/a
-[006] invalid data source name, [n/a] n/a
+[002] PDO::__construct(): Argument #1 ($dsn) must be a valid data source name, [n/a] n/a
+[003] PDO::__construct(): Argument #1 ($dsn) must be a valid data source name, [n/a] n/a
+[004] PDO::__construct(): Argument #1 ($dsn) must be a valid data source name, [n/a] n/a
+[005] PDO::__construct(): Argument #1 ($dsn) must be a valid data source name, [n/a] n/a
+[006] PDO::__construct(): Argument #1 ($dsn) must be a valid data source name, [n/a] n/a
 [007] could not find driver, [n/a] n/a
 [009] SQLSTATE[%s] [1045] Access denied for user 'dont%s'@'%s' (using password: YES), [n/a] n/a
 [017] DSN=%s, SQLSTATE[%s] [%d] %s
index 460edd0f26dea1cee4a316a0f8b3052752459e8b..e7cd87790658b1f9203171b46d8872296130c06b 100644 (file)
@@ -2282,15 +2282,15 @@ SXE_METHOD(__construct)
        }
 
        if (ZEND_SIZE_T_INT_OVFL(data_len)) {
-               zend_throw_exception(zend_ce_exception, "Data is too long", 0);
+               zend_argument_error(zend_ce_exception, 1, "is too long");
                RETURN_THROWS();
        }
        if (ZEND_SIZE_T_INT_OVFL(ns_len)) {
-               zend_throw_exception(zend_ce_exception, "Namespace is too long", 0);
+               zend_argument_error(zend_ce_exception, 4, "is too long");
                RETURN_THROWS();
        }
        if (ZEND_LONG_EXCEEDS_INT(options)) {
-               zend_throw_exception(zend_ce_exception, "Invalid options", 0);
+               zend_argument_error(zend_ce_exception, 2, "is invalid");
                RETURN_THROWS();
        }
 
index 20976c7d385c57e8800456f1fea8a93c56b7d440..86fb2f0f7289642ed4eda8fd195271eac7a972c9 100644 (file)
@@ -10,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
 $xml=new SimpleXMLElement(0,9000000000);var_dump($xml->getDocNamespaces())?>
 ?>
 --EXPECTF--
-Fatal error: Uncaught Exception: Invalid options in %sbug74950.php:%d
+Fatal error: Uncaught Exception: SimpleXMLElement::__construct(): Argument #2 ($options) is invalid in %sbug74950.php:%d
 Stack trace:
 #0 %sbug74950.php(%d): SimpleXMLElement->__construct('0', 9000000000)
 #1 {main}
index ac630871bd6a03ad961f43bc7eac949b18a4afad..6c720e2b170aa6c74e48a493c860f6387349b932 100644 (file)
@@ -1540,7 +1540,7 @@ PHP_METHOD(snmp, __construct)
                case SNMP_VERSION_3:
                        break;
                default:
-                       zend_throw_exception(zend_ce_exception, "Unknown SNMP protocol version", 0);
+                       zend_argument_value_error(zend_ce_exception, 1, "must be a valid SNMP protocol version");
                        RETURN_THROWS();
        }
 
index 20901ce7023654449fd2704d861b1378b4f181d0..56db079c359192b31b224ea8449f9bb47aae2da4 100644 (file)
@@ -72,7 +72,7 @@ var_dump($session->max_oids);
 SNMP::__construct() expects at least 3 parameters, 2 given
 SNMP::__construct(): Argument #4 must be of type int, string given
 SNMP::__construct(): Argument #5 must be of type int, string given
-Unknown SNMP protocol version
+SNMP::__construct(): Argument #1 ($version) must be a valid SNMP protocol version
 Exception handling
 
 Warning: SNMP::get(): Invalid object identifier: .1.3.6.1.2.1.1.1..0 in %s on line %d
index 3fd360407285813df07a5dcc8f19c85209efbdb4..9ccb9da3a5058a37181f16d18a4c61fd91c430c0 100644 (file)
@@ -93,7 +93,7 @@ PHP_FUNCTION(class_parents)
        }
 
        if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
-               zend_type_error("Object or string expected");
+               zend_argument_type_error(1, "must be of type object|string, %s given", zend_zval_type_name(obj));
                RETURN_THROWS();
        }
 
@@ -126,7 +126,7 @@ PHP_FUNCTION(class_implements)
                RETURN_THROWS();
        }
        if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
-               zend_type_error("Object or string expected");
+               zend_argument_type_error(1, "must be of type object|string, %s given", zend_zval_type_name(obj));
                RETURN_THROWS();
        }
 
@@ -155,7 +155,7 @@ PHP_FUNCTION(class_uses)
                RETURN_THROWS();
        }
        if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
-               zend_type_error("Object or string expected");
+               zend_argument_type_error(1, "must be of type object|string, %s given", zend_zval_type_name(obj));
                RETURN_THROWS();
        }
 
index 5c998c74944c8285d5b8ee48807240df1810b6c0..215abfe2c7eb41d5d81f2667b25355e95a49d2f7 100644 (file)
@@ -119,61 +119,61 @@ fclose($res);
 *** Testing class_implements() : variation ***
 
 --int 0--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, int given
 
 --int 1--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, int given
 
 --int 12345--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, int given
 
 --int -12345--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, int given
 
 --float 10.5--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, float given
 
 --float -10.5--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, float given
 
 --float 12.3456789000e10--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, float given
 
 --float -12.3456789000e10--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, float given
 
 --float .5--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, float given
 
 --empty array--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, array given
 
 --int indexed array--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, array given
 
 --associative array--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, array given
 
 --nested arrays--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, array given
 
 --uppercase NULL--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, null given
 
 --lowercase null--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, null given
 
 --lowercase true--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, bool given
 
 --lowercase false--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, bool given
 
 --uppercase TRUE--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, bool given
 
 --uppercase FALSE--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, bool given
 
 --empty string DQ--
 Error: 2 - class_implements(): Class  does not exist and could not be loaded, %s(%d)
@@ -194,10 +194,10 @@ array(0) {
 }
 
 --undefined var--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, null given
 
 --unset var--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, null given
 
 --resource--
-Object or string expected
+class_implements(): Argument #1 ($what) must be of type object|string, resource given
index c26fb67e0f56f068e20ef61106956d49496c60c7..5c766b9426a162ff150ea35fe6f6ef4623b0005b 100644 (file)
@@ -119,61 +119,61 @@ fclose($res);
 *** Testing class_uses() : variation ***
 
 --int 0--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, int given
 
 --int 1--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, int given
 
 --int 12345--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, int given
 
 --int -12345--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, int given
 
 --float 10.5--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, float given
 
 --float -10.5--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, float given
 
 --float 12.3456789000e10--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, float given
 
 --float -12.3456789000e10--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, float given
 
 --float .5--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, float given
 
 --empty array--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, array given
 
 --int indexed array--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, array given
 
 --associative array--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, array given
 
 --nested arrays--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, array given
 
 --uppercase NULL--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, null given
 
 --lowercase null--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, null given
 
 --lowercase true--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, bool given
 
 --lowercase false--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, bool given
 
 --uppercase TRUE--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, bool given
 
 --uppercase FALSE--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, bool given
 
 --empty string DQ--
 Error: 2 - class_uses(): Class  does not exist and could not be loaded, %s(%d)
@@ -192,10 +192,10 @@ array(0) {
 }
 
 --undefined var--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, null given
 
 --unset var--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, null given
 
 --resource--
-Object or string expected
+class_uses(): Argument #1 ($what) must be of type object|string, resource given
index abc855c752143a68e26e94c9d0c9df9da8504686..6ccaf2c829f3b3baca2e1b94bad13a980304d795 100644 (file)
@@ -819,7 +819,7 @@ static zend_bool zlib_create_dictionary_string(HashTable *options, char **dict,
                        } break;
 
                        default:
-                               zend_type_error("Dictionary must be of type zero-terminated string or array, got %s", zend_get_type_by_const(Z_TYPE_P(option_buffer)));
+                               zend_argument_type_error(2, "must be of type zero-terminated string or array, %s given", zend_get_type_by_const(Z_TYPE_P(option_buffer)));
                                return 0;
                }
        }