summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2020-04-13 10:41:23 +0200
committerMáté Kocsis <kocsismate@woohoolabs.com>2020-04-14 14:38:45 +0200
commit1f48feebb9be61cfd613f8fc62af87fa53bc741b (patch)
treedbe03782c5638e3f6de9f1eb287cbb724b432c1d
parent11c5c78401b803a8292958731a66ba39528fee0f (diff)
downloadphp-git-1f48feebb9be61cfd613f8fc62af87fa53bc741b.tar.gz
Improve some TypeError and ValueError messages
Closes GH-5377
-rw-r--r--ext/bz2/bz2.c2
-rw-r--r--ext/bz2/tests/001.phpt6
-rw-r--r--ext/gd/gd.c6
-rw-r--r--ext/gd/libgd/gd.h2
-rw-r--r--ext/iconv/tests/iconv_strpos.phpt4
-rw-r--r--ext/mbstring/mbstring.c4
-rw-r--r--ext/mbstring/tests/bug43840.phpt12
-rw-r--r--ext/mbstring/tests/bug43841.phpt12
-rw-r--r--ext/mbstring/tests/bug45923.phpt32
-rw-r--r--ext/mbstring/tests/mb_stripos_empty_needle.phpt8
-rw-r--r--ext/mbstring/tests/mb_stripos_invalid_offset.phpt20
-rw-r--r--ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt20
-rw-r--r--ext/mbstring/tests/mb_strpos_empty_needle.phpt8
-rw-r--r--ext/mbstring/tests/mb_strpos_invalid_offset.phpt20
-rw-r--r--ext/mbstring/tests/mb_strpos_offset_errors.phpt16
-rw-r--r--ext/mbstring/tests/mb_strpos_variation5.phpt20
-rw-r--r--ext/mbstring/tests/mb_strripos_empty_needle.phpt8
-rw-r--r--ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt16
-rw-r--r--ext/mbstring/tests/mb_strrpos_empty_needle.phpt8
-rw-r--r--ext/reflection/php_reflection.c4
-rw-r--r--ext/reflection/tests/ReflectionProperty_getValue_error.phpt2
-rw-r--r--ext/reflection/tests/ReflectionProperty_isInitialized.phpt2
-rw-r--r--ext/standard/array.c13
-rw-r--r--ext/standard/dir.c4
-rw-r--r--ext/standard/string.c20
-rw-r--r--ext/standard/tests/array/array_column_error.phpt8
-rw-r--r--ext/standard/tests/array/count_invalid_mode.phpt6
-rw-r--r--ext/standard/tests/dir/closedir_variation3.phpt2
-rw-r--r--ext/standard/tests/dir/rewinddir_variation3.phpt2
-rw-r--r--ext/standard/tests/serialize/max_depth.phpt4
-rw-r--r--ext/standard/tests/strings/bug40754.phpt10
-rw-r--r--ext/standard/tests/strings/count_chars_basic.phpt2
-rw-r--r--ext/standard/tests/strings/str_repeat.phptbin3055 -> 3070 bytes
-rw-r--r--ext/standard/tests/strings/stripos_error.phpt4
-rw-r--r--ext/standard/tests/strings/stripos_variation11.phpt16
-rw-r--r--ext/standard/tests/strings/stripos_variation7.phpt2
-rw-r--r--ext/standard/tests/strings/strpos.phptbin8041 -> 8133 bytes
-rw-r--r--ext/standard/tests/strings/strripos_offset.phpt8
-rw-r--r--ext/standard/tests/strings/strrpos_negative_offset.phpt4
-rw-r--r--ext/standard/tests/strings/strrpos_offset.phpt8
-rw-r--r--ext/standard/tests/strings/strrpos_variation11.phpt16
-rw-r--r--ext/standard/tests/strings/strrpos_variation7.phpt2
-rw-r--r--ext/standard/user_filters.c2
-rw-r--r--ext/standard/var.c4
-rw-r--r--ext/tokenizer/tests/PhpToken_methods.phpt4
-rw-r--r--ext/tokenizer/tokenizer.c4
46 files changed, 188 insertions, 189 deletions
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c
index 360f9d9c20..ee690dbda3 100644
--- a/ext/bz2/bz2.c
+++ b/ext/bz2/bz2.c
@@ -345,7 +345,7 @@ PHP_FUNCTION(bzopen)
}
if (mode_len != 1 || (mode[0] != 'r' && mode[0] != 'w')) {
- zend_argument_value_error(2, "must be a valid mode. Only 'w' and 'r' are supported");
+ zend_argument_value_error(2, "must be either 'r' or 'w'");
RETURN_THROWS();
}
diff --git a/ext/bz2/tests/001.phpt b/ext/bz2/tests/001.phpt
index 081558a7d4..90547c6642 100644
--- a/ext/bz2/tests/001.phpt
+++ b/ext/bz2/tests/001.phpt
@@ -37,15 +37,15 @@ var_dump(bzopen($fp, "r"));
?>
--EXPECTF--
-bzopen(): Argument #2 ($mode) must be a valid mode. Only 'w' and 'r' are supported
+bzopen(): Argument #2 ($mode) must be either 'r' or 'w'
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)
-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
+bzopen(): Argument #2 ($mode) must be either 'r' or 'w'
+bzopen(): Argument #2 ($mode) must be either 'r' or 'w'
Warning: bzopen(no_such_file): Failed to open stream: No such file or directory in %s on line %d
bool(false)
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 157460b50b..80b05ab89e 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -338,7 +338,7 @@ PHP_MINIT_FUNCTION(gd)
/* GD2 image format types */
REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORIZONTAL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT);
@@ -3536,7 +3536,7 @@ PHP_FUNCTION(imageflip)
gdImageFlipVertical(im);
break;
- case GD_FLIP_HORINZONTAL:
+ case GD_FLIP_HORIZONTAL:
gdImageFlipHorizontal(im);
break;
@@ -3545,7 +3545,7 @@ PHP_FUNCTION(imageflip)
break;
default:
- zend_argument_value_error(2, "must be a valid mode");
+ zend_argument_value_error(2, "must be either IMG_FLIP_VERTICAL, IMG_FLIP_HORIZONTAL, or IMG_FLIP_BOTH");
RETURN_THROWS();
}
diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h
index cddd6c1f7a..739f844f25 100644
--- a/ext/gd/libgd/gd.h
+++ b/ext/gd/libgd/gd.h
@@ -824,7 +824,7 @@ void gdImageFlipHorizontal(gdImagePtr im);
void gdImageFlipVertical(gdImagePtr im);
void gdImageFlipBoth(gdImagePtr im);
-#define GD_FLIP_HORINZONTAL 1
+#define GD_FLIP_HORIZONTAL 1
#define GD_FLIP_VERTICAL 2
#define GD_FLIP_BOTH 3
diff --git a/ext/iconv/tests/iconv_strpos.phpt b/ext/iconv/tests/iconv_strpos.phpt
index 860ecfc471..1dafd6c06b 100644
--- a/ext/iconv/tests/iconv_strpos.phpt
+++ b/ext/iconv/tests/iconv_strpos.phpt
@@ -36,12 +36,12 @@ var_dump(iconv_strpos("string", ""));
var_dump(iconv_strpos("", "string"));
?>
---EXPECTF--
+--EXPECT--
bool(false)
bool(false)
int(5)
int(5)
-Offset not contained in string
+strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
bool(false)
int(7)
int(7)
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 74274f4ae4..163943cddf 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -1986,10 +1986,10 @@ static void handle_strpos_error(size_t error) {
php_error_docref(NULL, E_WARNING, "Conversion error");
break;
case MBFL_ERROR_OFFSET:
- zend_value_error("Offset not contained in string");
+ zend_argument_value_error(3, "must be contained in argument #1 ($haystack)");
break;
default:
- zend_value_error("Unknown error in mb_strpos");
+ zend_value_error("mb_strpos(): Unknown error");
break;
}
}
diff --git a/ext/mbstring/tests/bug43840.phpt b/ext/mbstring/tests/bug43840.phpt
index 7a3fd03094..e225804f8a 100644
--- a/ext/mbstring/tests/bug43840.phpt
+++ b/ext/mbstring/tests/bug43840.phpt
@@ -54,18 +54,18 @@ bool(false)
-- Offset is 22 --
--Multibyte String:--
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--ASCII String:--
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Offset is 53 --
--Multibyte String:--
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--ASCII String:--
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Offset is 54 --
--Multibyte String:--
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--ASCII String:--
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/bug43841.phpt b/ext/mbstring/tests/bug43841.phpt
index 4a1da505d4..4297eeac00 100644
--- a/ext/mbstring/tests/bug43841.phpt
+++ b/ext/mbstring/tests/bug43841.phpt
@@ -47,21 +47,21 @@ foreach ($offsets as $i) {
--EXPECT--
-- Offset is -25 --
Multibyte String:
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
ASCII String:
mb_strrpos:
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
strrpos:
-Offset not contained in string
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Offset is -24 --
Multibyte String:
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
ASCII String:
mb_strrpos:
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
strrpos:
-Offset not contained in string
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Offset is -13 --
Multibyte String:
diff --git a/ext/mbstring/tests/bug45923.phpt b/ext/mbstring/tests/bug45923.phpt
index 37d2b13f8b..36fdda7c00 100644
--- a/ext/mbstring/tests/bug45923.phpt
+++ b/ext/mbstring/tests/bug45923.phpt
@@ -44,7 +44,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-Offset not contained in string
+strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
> Offset: -1
bool(false)
> Offset: -3
@@ -52,7 +52,7 @@ int(8)
> Offset: -6
int(8)
> Offset: -20
-Offset not contained in string
+strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
------- mb_strpos -----------
@@ -67,7 +67,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
> Offset: -1
bool(false)
> Offset: -3
@@ -75,7 +75,7 @@ int(8)
> Offset: -6
int(8)
> Offset: -20
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
------- stripos -----------
@@ -90,7 +90,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-Offset not contained in string
+stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
> Offset: -1
bool(false)
> Offset: -3
@@ -98,7 +98,7 @@ int(8)
> Offset: -6
int(8)
> Offset: -20
-Offset not contained in string
+stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
------- mb_stripos -----------
@@ -113,7 +113,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
> Offset: -1
bool(false)
> Offset: -3
@@ -121,7 +121,7 @@ int(8)
> Offset: -6
int(8)
> Offset: -20
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
------- strrpos -----------
@@ -136,7 +136,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-Offset not contained in string
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
> Offset: -1
int(8)
> Offset: -3
@@ -144,7 +144,7 @@ int(8)
> Offset: -6
int(4)
> Offset: -20
-Offset not contained in string
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
------- mb_strrpos -----------
@@ -159,7 +159,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
> Offset: -1
int(8)
> Offset: -3
@@ -167,7 +167,7 @@ int(8)
> Offset: -6
int(4)
> Offset: -20
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
------- strripos -----------
@@ -182,7 +182,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-Offset not contained in string
+strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
> Offset: -1
int(8)
> Offset: -3
@@ -190,7 +190,7 @@ int(8)
> Offset: -6
int(4)
> Offset: -20
-Offset not contained in string
+strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
------- mb_strripos -----------
@@ -205,7 +205,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
> Offset: -1
int(8)
> Offset: -3
@@ -213,4 +213,4 @@ int(8)
> Offset: -6
int(4)
> Offset: -20
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_stripos_empty_needle.phpt b/ext/mbstring/tests/mb_stripos_empty_needle.phpt
index d991e8bdb5..04e4dcef78 100644
--- a/ext/mbstring/tests/mb_stripos_empty_needle.phpt
+++ b/ext/mbstring/tests/mb_stripos_empty_needle.phpt
@@ -73,10 +73,10 @@ int(2)
int(5)
-- ASCII string with out of bound positive offset --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- ASCII string with out of bound negative offset --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Multi-byte string without offset --
int(0)
@@ -88,7 +88,7 @@ int(2)
int(19)
-- Multi-byte string with out of bound positive offset --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Multi-byte string with out of bound negative offset --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_stripos_invalid_offset.phpt b/ext/mbstring/tests/mb_stripos_invalid_offset.phpt
index f4ce16d010..123634faee 100644
--- a/ext/mbstring/tests/mb_stripos_invalid_offset.phpt
+++ b/ext/mbstring/tests/mb_stripos_invalid_offset.phpt
@@ -81,13 +81,13 @@ try {
--EXPECT--
String len: 42
== INVALID OFFSET ==
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt b/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt
index b071fdbff3..95db4a2c25 100644
--- a/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt
+++ b/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt
@@ -55,9 +55,9 @@ for ($i = -30; $i <= 60; $i += 10) {
**-- Offset is: -30 --**
-- ASCII String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: -20 --**
-- ASCII String --
@@ -91,24 +91,24 @@ int(20)
**-- Offset is: 30 --**
-- ASCII String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: 40 --**
-- ASCII String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: 50 --**
-- ASCII String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: 60 --**
-- ASCII String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_strpos_empty_needle.phpt b/ext/mbstring/tests/mb_strpos_empty_needle.phpt
index da3e984b3a..0517281f3f 100644
--- a/ext/mbstring/tests/mb_strpos_empty_needle.phpt
+++ b/ext/mbstring/tests/mb_strpos_empty_needle.phpt
@@ -72,10 +72,10 @@ int(2)
int(5)
-- ASCII string with out of bound positive offset --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- ASCII string with out of bound negative offset --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Multi-byte string without offset --
int(0)
@@ -87,7 +87,7 @@ int(2)
int(19)
-- Multi-byte string with out of bound positive offset --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Multi-byte string with out of bound negative offset --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_strpos_invalid_offset.phpt b/ext/mbstring/tests/mb_strpos_invalid_offset.phpt
index 3e2ea65e9a..46485291e6 100644
--- a/ext/mbstring/tests/mb_strpos_invalid_offset.phpt
+++ b/ext/mbstring/tests/mb_strpos_invalid_offset.phpt
@@ -81,13 +81,13 @@ try {
--EXPECT--
String len: 42
== INVALID OFFSET ==
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_strpos_offset_errors.phpt b/ext/mbstring/tests/mb_strpos_offset_errors.phpt
index 41d7e257d4..68dc75b338 100644
--- a/ext/mbstring/tests/mb_strpos_offset_errors.phpt
+++ b/ext/mbstring/tests/mb_strpos_offset_errors.phpt
@@ -46,11 +46,11 @@ try {
?>
--EXPECT--
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_strpos_variation5.phpt b/ext/mbstring/tests/mb_strpos_variation5.phpt
index fe7542099a..ea2192087a 100644
--- a/ext/mbstring/tests/mb_strpos_variation5.phpt
+++ b/ext/mbstring/tests/mb_strpos_variation5.phpt
@@ -55,9 +55,9 @@ for ($i = -30; $i <= 60; $i += 10) {
**-- Offset is: -30 --**
-- ASCII String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: -20 --**
-- ASCII String --
@@ -91,24 +91,24 @@ int(20)
**-- Offset is: 30 --**
-- ASCII String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: 40 --**
-- ASCII String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: 50 --**
-- ASCII String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: 60 --**
-- ASCII String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_strripos_empty_needle.phpt b/ext/mbstring/tests/mb_strripos_empty_needle.phpt
index 7d41b05a61..ebc5e54060 100644
--- a/ext/mbstring/tests/mb_strripos_empty_needle.phpt
+++ b/ext/mbstring/tests/mb_strripos_empty_needle.phpt
@@ -73,10 +73,10 @@ int(7)
int(5)
-- ASCII string with out of bound positive offset --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- ASCII string with out of bound negative offset --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Multi-byte string without offset --
int(21)
@@ -88,7 +88,7 @@ int(21)
int(19)
-- Multi-byte string with out of bound positive offset --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Multi-byte string with out of bound negative offset --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt b/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt
index ad20bfe3d9..4160643ce6 100644
--- a/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt
+++ b/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt
@@ -81,24 +81,24 @@ int(20)
**-- Offset is: 30 --**
-- ASCII String --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: 40 --**
-- ASCII String --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: 50 --**
-- ASCII String --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
**-- Offset is: 60 --**
-- ASCII String --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--Multibyte String --
-Offset not contained in string
+mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/mbstring/tests/mb_strrpos_empty_needle.phpt b/ext/mbstring/tests/mb_strrpos_empty_needle.phpt
index 974c44dac0..6be2773276 100644
--- a/ext/mbstring/tests/mb_strrpos_empty_needle.phpt
+++ b/ext/mbstring/tests/mb_strrpos_empty_needle.phpt
@@ -73,10 +73,10 @@ int(7)
int(5)
-- ASCII string with out of bound positive offset --
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- ASCII string with out of bound negative offset --
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Multi-byte string without offset --
int(21)
@@ -88,7 +88,7 @@ int(21)
int(19)
-- Multi-byte string with out of bound positive offset --
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Multi-byte string with out of bound negative offset --
-Offset not contained in string
+mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 6023ef0c0d..e23f0076a9 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -5335,7 +5335,7 @@ ZEND_METHOD(ReflectionProperty, getValue)
zval rv;
if (!object) {
- zend_type_error("No object provided for getValue() on instance property");
+ zend_argument_type_error(1, "must be provided for instance properties");
RETURN_THROWS();
}
@@ -5428,7 +5428,7 @@ ZEND_METHOD(ReflectionProperty, isInitialized)
int retval;
if (!object) {
- zend_type_error("No object provided for isInitialized() on instance property");
+ zend_argument_type_error(1, "must be provided for instance properties");
RETURN_THROWS();
}
diff --git a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
index c5da067c32..40254319cc 100644
--- a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
@@ -66,4 +66,4 @@ Invalid instance:
Given object is not an instance of the class this property was declared in
Missing instance:
-No object provided for getValue() on instance property
+ReflectionProperty::getValue(): Argument #1 ($object) must be provided for instance properties
diff --git a/ext/reflection/tests/ReflectionProperty_isInitialized.phpt b/ext/reflection/tests/ReflectionProperty_isInitialized.phpt
index 29541e405b..ac87873c6a 100644
--- a/ext/reflection/tests/ReflectionProperty_isInitialized.phpt
+++ b/ext/reflection/tests/ReflectionProperty_isInitialized.phpt
@@ -114,7 +114,7 @@ bool(false)
Object type:
bool(false)
Given object is not an instance of the class this property was declared in
-No object provided for isInitialized() on instance property
+ReflectionProperty::isInitialized(): Argument #1 ($object) must be provided for instance properties
Class with __isset:
bool(false)
bool(false)
diff --git a/ext/standard/array.c b/ext/standard/array.c
index daecdc7a52..dd7914f8c7 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -704,7 +704,7 @@ PHP_FUNCTION(count)
ZEND_PARSE_PARAMETERS_END();
if (mode != COUNT_NORMAL && mode != COUNT_RECURSIVE) {
- zend_argument_value_error(2, "must be a valid mode");
+ zend_argument_value_error(2, "must be either COUNT_NORMAL or COUNT_RECURSIVE");
RETURN_THROWS();
}
@@ -4087,8 +4087,7 @@ PHP_FUNCTION(array_count_values)
* Specialized conversion rules for array_column() function
*/
static inline
-zend_bool array_column_param_helper(zval *param,
- const char *name) {
+zend_bool array_column_param_helper(zval *param, int parameter_number) {
switch (Z_TYPE_P(param)) {
case IS_DOUBLE:
convert_to_long_ex(param);
@@ -4105,7 +4104,7 @@ zend_bool array_column_param_helper(zval *param,
return 1;
default:
- zend_type_error("The %s key should be either a string or an integer", name);
+ zend_argument_type_error(parameter_number, "must be of type string|int, %s given", zend_zval_type_name(param));
return 0;
}
}
@@ -4166,9 +4165,9 @@ PHP_FUNCTION(array_column)
Z_PARAM_ZVAL_EX(index, 1, 0)
ZEND_PARSE_PARAMETERS_END();
- if ((column && !array_column_param_helper(column, "column")) ||
- (index && !array_column_param_helper(index, "index"))) {
- return;
+ if ((column && !array_column_param_helper(column, 2)) ||
+ (index && !array_column_param_helper(index, 3))) {
+ RETURN_THROWS();
}
array_init_size(return_value, zend_hash_num_elements(input));
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index 0b18c1f146..da1af5ad74 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -254,7 +254,7 @@ PHP_FUNCTION(closedir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- zend_type_error("%d is not a valid Directory resource", dirp->res->handle);
+ zend_argument_type_error(1, "must be a valid Directory resource");
RETURN_THROWS();
}
@@ -368,7 +368,7 @@ PHP_FUNCTION(rewinddir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- zend_type_error("%d is not a valid Directory resource", dirp->res->handle);
+ zend_argument_type_error(1, "must be a valid Directory resource");
RETURN_THROWS();
}
diff --git a/ext/standard/string.c b/ext/standard/string.c
index a22992aa81..4c0aaad974 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1889,7 +1889,7 @@ PHP_FUNCTION(strpos)
offset += (zend_long)ZSTR_LEN(haystack);
}
if (offset < 0 || (size_t)offset > ZSTR_LEN(haystack)) {
- zend_value_error("Offset not contained in string");
+ zend_argument_value_error(3, "must be contained in argument #1 ($haystack)");
RETURN_THROWS();
}
@@ -1925,7 +1925,7 @@ PHP_FUNCTION(stripos)
offset += (zend_long)ZSTR_LEN(haystack);
}
if (offset < 0 || (size_t)offset > ZSTR_LEN(haystack)) {
- zend_value_error("Offset not contained in string");
+ zend_argument_value_error(3, "must be contained in argument #1 ($haystack)");
RETURN_THROWS();
}
@@ -1967,14 +1967,14 @@ PHP_FUNCTION(strrpos)
if (offset >= 0) {
if ((size_t)offset > ZSTR_LEN(haystack)) {
- zend_value_error("Offset not contained in string");
+ zend_argument_value_error(3, "must be contained in argument #1 ($haystack)");
RETURN_THROWS();
}
p = ZSTR_VAL(haystack) + (size_t)offset;
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
} else {
if (offset < -ZEND_LONG_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
- zend_value_error("Offset not contained in string");
+ zend_argument_value_error(3, "must be contained in argument #1 ($haystack)");
RETURN_THROWS();
}
@@ -2017,7 +2017,7 @@ PHP_FUNCTION(strripos)
char lowered;
if (offset >= 0) {
if ((size_t)offset > ZSTR_LEN(haystack)) {
- zend_value_error("Offset not contained in string");
+ zend_argument_value_error(3, "must be contained in argument #1 ($haystack)");
RETURN_THROWS();
}
p = ZSTR_VAL(haystack) + (size_t)offset;
@@ -2025,7 +2025,7 @@ PHP_FUNCTION(strripos)
} else {
p = ZSTR_VAL(haystack);
if (offset < -ZEND_LONG_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
- zend_value_error("Offset not contained in string");
+ zend_argument_value_error(3, "must be contained in argument #1 ($haystack)");
RETURN_THROWS();
}
e = ZSTR_VAL(haystack) + (ZSTR_LEN(haystack) + (size_t)offset);
@@ -2045,7 +2045,7 @@ PHP_FUNCTION(strripos)
if (offset >= 0) {
if ((size_t)offset > ZSTR_LEN(haystack)) {
zend_string_release_ex(haystack_dup, 0);
- zend_value_error("Offset not contained in string");
+ zend_argument_value_error(3, "must be contained in argument #1 ($haystack)");
RETURN_THROWS();
}
p = ZSTR_VAL(haystack_dup) + offset;
@@ -2053,7 +2053,7 @@ PHP_FUNCTION(strripos)
} else {
if (offset < -ZEND_LONG_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
zend_string_release_ex(haystack_dup, 0);
- zend_value_error("Offset not contained in string");
+ zend_argument_value_error(3, "must be contained in argument #1 ($haystack)");
RETURN_THROWS();
}
@@ -5273,7 +5273,7 @@ PHP_FUNCTION(str_repeat)
ZEND_PARSE_PARAMETERS_END();
if (mult < 0) {
- zend_value_error("Second argument has to be greater than or equal to 0");
+ zend_argument_value_error(2, "must be greater than or equal to 0");
RETURN_THROWS();
}
@@ -5331,7 +5331,7 @@ PHP_FUNCTION(count_chars)
ZEND_PARSE_PARAMETERS_END();
if (mymode < 0 || mymode > 4) {
- zend_value_error("Unknown mode");
+ zend_argument_value_error(2, "must be between 1 and 4 (inclusive)");
RETURN_THROWS();
}
diff --git a/ext/standard/tests/array/array_column_error.phpt b/ext/standard/tests/array/array_column_error.phpt
index 6fb5169d45..547ecf91cb 100644
--- a/ext/standard/tests/array/array_column_error.phpt
+++ b/ext/standard/tests/array/array_column_error.phpt
@@ -46,15 +46,15 @@ DONE
*** Testing array_column() : error conditions ***
-- Testing array_column() column key parameter should be a string or an integer (testing bool) --
-The column key should be either a string or an integer
+array_column(): Argument #2 ($column_key) must be of type string|int, bool given
-- Testing array_column() column key parameter should be a string or integer (testing array) --
-The column key should be either a string or an integer
+array_column(): Argument #2 ($column_key) must be of type string|int, array given
-- Testing array_column() index key parameter should be a string or an integer (testing bool) --
-The index key should be either a string or an integer
+array_column(): Argument #3 ($index_key) must be of type string|int, bool given
-- Testing array_column() index key parameter should be a string or integer (testing array) --
-The index key should be either a string or an integer
+array_column(): Argument #3 ($index_key) must be of type string|int, array given
DONE
diff --git a/ext/standard/tests/array/count_invalid_mode.phpt b/ext/standard/tests/array/count_invalid_mode.phpt
index a411a2983e..4f7950e727 100644
--- a/ext/standard/tests/array/count_invalid_mode.phpt
+++ b/ext/standard/tests/array/count_invalid_mode.phpt
@@ -29,9 +29,9 @@ int(0)
int(0)
int(0)
int(0)
-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
+count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
+count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
+count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
int(0)
int(0)
int(0)
diff --git a/ext/standard/tests/dir/closedir_variation3.phpt b/ext/standard/tests/dir/closedir_variation3.phpt
index 1d9c644a3e..0f50c1db03 100644
--- a/ext/standard/tests/dir/closedir_variation3.phpt
+++ b/ext/standard/tests/dir/closedir_variation3.phpt
@@ -37,7 +37,7 @@ if(is_resource($fp)) {
resource(%d) of type (stream)
-- Try to close the file pointer using closedir() --
-%d is not a valid Directory resource
+closedir(): Argument #1 ($dir_handle) must be a valid Directory resource
-- Check file pointer: --
resource(%d) of type (stream)
diff --git a/ext/standard/tests/dir/rewinddir_variation3.phpt b/ext/standard/tests/dir/rewinddir_variation3.phpt
index 07508eac3f..7619f82ecf 100644
--- a/ext/standard/tests/dir/rewinddir_variation3.phpt
+++ b/ext/standard/tests/dir/rewinddir_variation3.phpt
@@ -38,7 +38,7 @@ if ($result1 === $result2) {
-- Open a file using fopen --
resource(%d) of type (stream)
-%d is not a valid Directory resource
+rewinddir(): Argument #1 ($dir_handle) must be a valid Directory resource
-- Check if rewinddir() has repositioned the file pointer --
rewinddir() does not work on file pointers
diff --git a/ext/standard/tests/serialize/max_depth.phpt b/ext/standard/tests/serialize/max_depth.phpt
index 5e1c869b1d..79ab13e9f1 100644
--- a/ext/standard/tests/serialize/max_depth.phpt
+++ b/ext/standard/tests/serialize/max_depth.phpt
@@ -104,8 +104,8 @@ var_dump(is_array(unserialize(
?>
--EXPECTF--
Invalid max_depth:
-max_depth should be int
-max_depth cannot be negative
+unserialize(): 'max_depth' option must be of type int, string given
+unserialize(): 'max_depth' option must be greater than or equal to 0
Array:
bool(true)
diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt
index 5f35b4da44..b71f28044a 100644
--- a/ext/standard/tests/strings/bug40754.phpt
+++ b/ext/standard/tests/strings/bug40754.phpt
@@ -71,15 +71,15 @@ substr_count(): Argument #3 ($offset) must be contained in argument #1 ($haystac
Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
bool(false)
-Offset not contained in string
+stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
substr_count(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
Warning: substr_count(): Invalid length value in %s on line %d
bool(false)
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
+strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
int(2)
string(8) "abcdeabc"
bool(false)
diff --git a/ext/standard/tests/strings/count_chars_basic.phpt b/ext/standard/tests/strings/count_chars_basic.phpt
index c1868714b0..0e5c3455e8 100644
--- a/ext/standard/tests/strings/count_chars_basic.phpt
+++ b/ext/standard/tests/strings/count_chars_basic.phpt
@@ -1575,4 +1575,4 @@ array(238) {
}
string(18) " Rabcdefghimnorstu"
string(476) "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f5051535455565758595a5b5c5d5e5f606a6b6c7071767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
-Unknown mode
+count_chars(): Argument #2 ($mode) must be between 1 and 4 (inclusive)
diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt
index 4751dc783f..73a17818ef 100644
--- a/ext/standard/tests/strings/str_repeat.phpt
+++ b/ext/standard/tests/strings/str_repeat.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt
index caa9329874..57ad35135f 100644
--- a/ext/standard/tests/strings/stripos_error.phpt
+++ b/ext/standard/tests/strings/stripos_error.phpt
@@ -29,8 +29,8 @@ echo "*** Done ***";
*** Testing stripos() function: error conditions ***
-- Offset beyond the end of the string --
-Offset not contained in string
+stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Offset before the start of the string --
-Offset not contained in string
+stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt
index 9b7ff24350..b1e72e3e4c 100644
--- a/ext/standard/tests/strings/stripos_variation11.phpt
+++ b/ext/standard/tests/strings/stripos_variation11.phpt
@@ -145,35 +145,35 @@ int(0)
bool(false)
-- Iteration 16 --
int(0)
-ValueError: Offset not contained in string
+ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 17 --
int(0)
bool(false)
-- Iteration 18 --
int(0)
-ValueError: Offset not contained in string
+ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 19 --
int(0)
bool(false)
-- Iteration 20 --
int(0)
-ValueError: Offset not contained in string
+ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 21 --
int(0)
-ValueError: Offset not contained in string
+ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 22 --
int(0)
-ValueError: Offset not contained in string
+ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 23 --
int(0)
-ValueError: Offset not contained in string
+ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 24 --
TypeError: stripos(): Argument #1 ($haystack) must be of type string, resource given
TypeError: stripos(): Argument #1 ($haystack) must be of type string, resource given
-- Iteration 25 --
int(0)
-ValueError: Offset not contained in string
+ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 26 --
int(0)
-ValueError: Offset not contained in string
+ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation7.phpt b/ext/standard/tests/strings/stripos_variation7.phpt
index d2ac6551db..f6b1239973 100644
--- a/ext/standard/tests/strings/stripos_variation7.phpt
+++ b/ext/standard/tests/strings/stripos_variation7.phpt
@@ -31,7 +31,7 @@ echo "*** Done ***";
*** Testing stripos() function: with heredoc strings ***
-- With empty heredoc string --
int(0)
-Offset not contained in string
+stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
int(0)
int(0)
*** Done ***
diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt
index 2d44cd9212..1c9045b76a 100644
--- a/ext/standard/tests/strings/strpos.phpt
+++ b/ext/standard/tests/strings/strpos.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt
index 39d0bf16f8..59b5374cae 100644
--- a/ext/standard/tests/strings/strripos_offset.phpt
+++ b/ext/standard/tests/strings/strripos_offset.phpt
@@ -37,8 +37,8 @@ echo "Done\n";
?>
--EXPECT--
strripos(): Argument #3 ($offset) must be of type int, float given
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
+strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
Done
diff --git a/ext/standard/tests/strings/strrpos_negative_offset.phpt b/ext/standard/tests/strings/strrpos_negative_offset.phpt
index 41b2b16b56..e4ac469ba4 100644
--- a/ext/standard/tests/strings/strrpos_negative_offset.phpt
+++ b/ext/standard/tests/strings/strrpos_negative_offset.phpt
@@ -32,11 +32,11 @@ int(7)
bool(false)
int(5)
int(1)
-Offset not contained in string
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
int(0)
int(0)
int(7)
bool(false)
int(5)
int(1)
-Offset not contained in string
+strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt
index 13df98e71c..46b37955e4 100644
--- a/ext/standard/tests/strings/strrpos_offset.phpt
+++ b/ext/standard/tests/strings/strrpos_offset.phpt
@@ -37,8 +37,8 @@ echo "Done\n";
?>
--EXPECT--
strrpos(): Argument #3 ($offset) must be of type int, float given
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
-Offset not contained in string
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
Done
diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt
index df0aac0153..185af4e154 100644
--- a/ext/standard/tests/strings/strrpos_variation11.phpt
+++ b/ext/standard/tests/strings/strrpos_variation11.phpt
@@ -146,35 +146,35 @@ int(0)
bool(false)
-- Iteration 16 --
int(0)
-ValueError: Offset not contained in string
+ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 17 --
int(0)
bool(false)
-- Iteration 18 --
int(0)
-ValueError: Offset not contained in string
+ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 19 --
int(0)
bool(false)
-- Iteration 20 --
int(0)
-ValueError: Offset not contained in string
+ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 21 --
int(0)
-ValueError: Offset not contained in string
+ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 22 --
int(0)
-ValueError: Offset not contained in string
+ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 23 --
int(0)
-ValueError: Offset not contained in string
+ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 24 --
TypeError: strrpos(): Argument #1 ($haystack) must be of type string, resource given
TypeError: strrpos(): Argument #1 ($haystack) must be of type string, resource given
-- Iteration 25 --
int(0)
-ValueError: Offset not contained in string
+ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Iteration 26 --
int(0)
-ValueError: Offset not contained in string
+ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt
index 9a02a4a0ec..79715453c9 100644
--- a/ext/standard/tests/strings/strrpos_variation7.phpt
+++ b/ext/standard/tests/strings/strrpos_variation7.phpt
@@ -30,7 +30,7 @@ echo "*** Done ***";
*** Testing strrpos() function: with heredoc strings ***
-- With empty heredoc string --
int(0)
-Offset not contained in string
+strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
int(0)
int(0)
*** Done ***
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index fc8fd826c8..4d11ae2b44 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -416,7 +416,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
ZEND_PARSE_PARAMETERS_END();
if (NULL == (pzbucket = zend_hash_str_find(Z_OBJPROP_P(zobject), "bucket", sizeof("bucket")-1))) {
- zend_value_error("Object has no bucket property");
+ zend_argument_value_error(2, "must be an object that has a 'bucket' property");
RETURN_THROWS();
}
diff --git a/ext/standard/var.c b/ext/standard/var.c
index dc133dd5ce..e1bc4c5597 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -1240,11 +1240,11 @@ PHP_FUNCTION(unserialize)
max_depth = zend_hash_str_find_deref(Z_ARRVAL_P(options), "max_depth", sizeof("max_depth") - 1);
if (max_depth) {
if (Z_TYPE_P(max_depth) != IS_LONG) {
- zend_type_error("max_depth should be int");
+ zend_type_error("unserialize(): 'max_depth' option must be of type int, %s given", zend_zval_type_name(max_depth));
goto cleanup;
}
if (Z_LVAL_P(max_depth) < 0) {
- zend_value_error("max_depth cannot be negative");
+ zend_value_error("unserialize(): 'max_depth' option must be greater than or equal to 0");
goto cleanup;
}
diff --git a/ext/tokenizer/tests/PhpToken_methods.phpt b/ext/tokenizer/tests/PhpToken_methods.phpt
index 9429cea7ed..3e08f3c39e 100644
--- a/ext/tokenizer/tests/PhpToken_methods.phpt
+++ b/ext/tokenizer/tests/PhpToken_methods.phpt
@@ -108,8 +108,8 @@ bool(false)
bool(false)
Error:
-Kind must be of type int, string or array
-Kind array must have elements of type int or string
+PhpToken::is(): Argument #1 ($kind) must be of type string|int|array, float given
+PhpToken::is(): Argument #1 ($kind) must only have elements of type string|int, float given
Typed property PhpToken::$id must not be accessed before initialization
Typed property PhpToken::$text must not be accessed before initialization
Typed property PhpToken::$id must not be accessed before initialization
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index f07a839bb6..db57323223 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -192,13 +192,13 @@ PHP_METHOD(PhpToken, is)
RETURN_TRUE;
}
} else {
- zend_type_error("Kind array must have elements of type int or string");
+ zend_argument_type_error(1, "must only have elements of type string|int, %s given", zend_zval_type_name(entry));
RETURN_THROWS();
}
} ZEND_HASH_FOREACH_END();
RETURN_FALSE;
} else {
- zend_type_error("Kind must be of type int, string or array");
+ zend_argument_type_error(1, "must be of type string|int|array, %s given", zend_zval_type_name(kind));
RETURN_THROWS();
}
}