Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 917e072

Browse files
committed
Fix type errors text to comply with one that PHP throws
1 parent 7407477 commit 917e072

5 files changed

+12
-12
lines changed

src/php_v8_function.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ bool php_v8_function_unpack_args(zval *arguments_zv, int arg_position, v8::Isola
5252
ZEND_HASH_FOREACH_VAL(myht, pzval) {
5353
if (Z_TYPE_P(pzval) != IS_OBJECT) {
5454
zend_throw_error(zend_ce_type_error,
55-
"Argument %d passed to %s::%s() should be array of \\V8\\Value objects, %s given at %d offset",
55+
"Argument %d passed to %s::%s() must be an array of \\V8\\Value objects, %s given at %d offset",
5656
arg_position, ZSTR_VAL(ce_name), get_active_function_name(),
5757
zend_zval_type_name(pzval), i);
5858

@@ -62,7 +62,7 @@ bool php_v8_function_unpack_args(zval *arguments_zv, int arg_position, v8::Isola
6262

6363
if (!instanceof_function(Z_OBJCE_P(pzval), php_v8_value_class_entry)) {
6464
zend_throw_error(zend_ce_type_error,
65-
"Argument %d passed to %s::%s() should be array of \\V8\\Value objects, instance of %s given at %d offset",
65+
"Argument %d passed to %s::%s() must be an array of \\V8\\Value objects, instance of %s given at %d offset",
6666
arg_position, ZSTR_VAL(ce_name), get_active_function_name(),
6767
ZSTR_VAL(Z_OBJCE_P(pzval)->name), i);
6868

@@ -137,7 +137,7 @@ bool php_v8_function_unpack_string_args(zval* arguments_zv, int arg_position, v8
137137
ZEND_HASH_FOREACH_VAL(myht, pzval) {
138138
if (Z_TYPE_P(pzval) != IS_OBJECT) {
139139
zend_throw_error(zend_ce_type_error,
140-
"Argument %d passed to %s::%s() should be array of \\V8\\StringValue objects, %s given at %d offset",
140+
"Argument %d passed to %s::%s() must be an array of \\V8\\StringValue objects, %s given at %d offset",
141141
arg_position, ZSTR_VAL(ce_name), get_active_function_name(),
142142
zend_zval_type_name(pzval), i);
143143

@@ -147,7 +147,7 @@ bool php_v8_function_unpack_string_args(zval* arguments_zv, int arg_position, v8
147147

148148
if (!instanceof_function(Z_OBJCE_P(pzval), php_v8_string_class_entry)) {
149149
zend_throw_error(zend_ce_type_error,
150-
"Argument %d passed to %s::%s() should be array of \\V8\\StringValue, instance of %s given at %d offset",
150+
"Argument %d passed to %s::%s() must be an array of \\V8\\StringValue, instance of %s given at %d offset",
151151
arg_position, ZSTR_VAL(ce_name), get_active_function_name(),
152152
ZSTR_VAL(Z_OBJCE_P(pzval)->name), i);
153153

@@ -222,7 +222,7 @@ bool php_v8_function_unpack_object_args(zval* arguments_zv, int arg_position, v8
222222
ZEND_HASH_FOREACH_VAL(myht, pzval) {
223223
if (Z_TYPE_P(pzval) != IS_OBJECT) {
224224
zend_throw_error(zend_ce_type_error,
225-
"Argument %d passed to %s::%s() should be array of \\V8\\ObjectValue objects, %s given at %d offset",
225+
"Argument %d passed to %s::%s() must be an array of \\V8\\ObjectValue objects, %s given at %d offset",
226226
arg_position, ZSTR_VAL(ce_name), get_active_function_name(),
227227
zend_zval_type_name(pzval), i);
228228

@@ -232,7 +232,7 @@ bool php_v8_function_unpack_object_args(zval* arguments_zv, int arg_position, v8
232232

233233
if (!instanceof_function(Z_OBJCE_P(pzval), php_v8_object_class_entry)) {
234234
zend_throw_error(zend_ce_type_error,
235-
"Argument %d passed to %s::%s() should be array of \\V8\\ObjectValue, instance of %s given at %d offset",
235+
"Argument %d passed to %s::%s() must be an array of \\V8\\ObjectValue, instance of %s given at %d offset",
236236
arg_position, ZSTR_VAL(ce_name), get_active_function_name(),
237237
ZSTR_VAL(Z_OBJCE_P(pzval)->name), i);
238238

src/php_v8_template.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void php_v8_template_Set(v8::Isolate *isolate, v8::Local<T> local_template, N* p
147147
zend_string *ce_name = zend_get_executed_scope()->name;
148148

149149
zend_throw_error(zend_ce_type_error,
150-
"Argument %d passed to %s::%s() should be instance of \\V8\\PrimitiveValue or \\V8\\Template, instance of %s given",
150+
"Argument %d passed to %s::%s() must be an instance of \\V8\\PrimitiveValue or \\V8\\Template, instance of %s given",
151151
arg_position, ZSTR_VAL(ce_name), get_active_function_name(), ZSTR_VAL(Z_OBJCE_P(php_v8_value_zv)->name));
152152
return;
153153
}

tests/V8FunctionObject_Call_bad_args.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ try {
5656
}
5757
?>
5858
--EXPECT--
59-
TypeError: Argument 3 passed to V8\FunctionObject::Call() should be array of \V8\Value objects, integer given at 0 offset
60-
TypeError: Argument 3 passed to V8\FunctionObject::Call() should be array of \V8\Value objects, instance of stdClass given at 0 offset
59+
TypeError: Argument 3 passed to V8\FunctionObject::Call() must be an array of \V8\Value objects, integer given at 0 offset
60+
TypeError: Argument 3 passed to V8\FunctionObject::Call() must be an array of \V8\Value objects, instance of stdClass given at 0 offset
6161
V8\Exceptions\Exception: Value is empty. Forgot to call parent::__construct()?: argument 3 passed to V8\FunctionObject::Call() at 0 offset
6262
V8\Exceptions\Exception: Isolates mismatch: argument 3 passed to V8\FunctionObject::Call() at 0 offset

tests/V8FunctionTemplate_Set.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ console.log(nt.foo);
5252

5353
?>
5454
--EXPECT--
55-
TypeError: Argument 3 passed to V8\ObjectTemplate::Set() should be instance of \V8\PrimitiveValue or \V8\Template, instance of V8\FunctionObject given
55+
TypeError: Argument 3 passed to V8\ObjectTemplate::Set() must be an instance of \V8\PrimitiveValue or \V8\Template, instance of V8\FunctionObject given
5656
function Test() { [native code] }
5757
[object Test]
5858
function foo() { [native code] }

tests/V8ScriptCompiler_CompileFunctionInContext.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ Compile function: ok
134134
Compile function: ok
135135
Compile function: ok
136136
Compile function: ok
137-
TypeError: Argument 3 passed to V8\ScriptCompiler::CompileFunctionInContext() should be array of \V8\StringValue, instance of V8\StringObject given at 0 offset
138-
TypeError: Argument 4 passed to V8\ScriptCompiler::CompileFunctionInContext() should be array of \V8\ObjectValue, instance of V8\StringValue given at 0 offset
137+
TypeError: Argument 3 passed to V8\ScriptCompiler::CompileFunctionInContext() must be an array of \V8\StringValue, instance of V8\StringObject given at 0 offset
138+
TypeError: Argument 4 passed to V8\ScriptCompiler::CompileFunctionInContext() must be an array of \V8\ObjectValue, instance of V8\StringValue given at 0 offset
139139

140140

141141
Testing:

0 commit comments

Comments
 (0)