Skip to content

Make zpp failures always throw, independent of strict_types #3794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
b708b08
Make zpp failures always throw, independent of strict_types
nikic Feb 5, 2019
094b224
Rename some _exception APIs to _error
nikic Feb 19, 2019
1156bc5
Remove explicit uses of ZEND_PARSE_PARAMS_THROW
nikic Feb 19, 2019
3c10cf1
Start on test fixes
nikic Feb 19, 2019
14a702c
More test fixes
nikic Mar 5, 2019
32e5c7a
Intl: Don't separately report "bad arguments" errors
nikic Mar 5, 2019
90b29e4
More test updates
nikic Mar 5, 2019
48df358
Test tweaks
nikic Mar 5, 2019
f92fa89
gd tweaks
nikic Mar 5, 2019
e99ea84
Test tweaks
nikic Mar 5, 2019
3448a4c
Gmp fixes
nikic Mar 5, 2019
56d6635
Hash fixes
nikic Mar 5, 2019
2f2ee46
pcre fixes
nikic Mar 5, 2019
73de76c
Reflection fixes
nikic Mar 5, 2019
f67dc49
sockets test fixes
nikic Mar 6, 2019
3e0b31a
Remove some unnecessary error handler setting
nikic Mar 6, 2019
1f801dc
SPL test fixes
nikic Mar 6, 2019
29483fe
Standard array test updates
nikic Mar 6, 2019
4f7c13c
More spl fixes
nikic Mar 6, 2019
5d6e116
bz2 test fixes
nikic Mar 7, 2019
1f29b78
finfo test updates
nikic Mar 7, 2019
bdaa18a
filter test updates
nikic Mar 7, 2019
f40459c
json test updates
nikic Mar 7, 2019
01edef7
ftp test fixes
nikic Mar 7, 2019
a9f1a60
libxml test fixes
nikic Mar 7, 2019
226c2ff
openssl test fixes
nikic Mar 7, 2019
2d92914
phar test fixes
nikic Mar 7, 2019
73157d8
readline test fixes
nikic Mar 7, 2019
2fbf0a7
session test fixes
nikic Mar 7, 2019
a844db6
array test fixes
nikic Mar 7, 2019
c9f894d
class_object test fixes
nikic Mar 7, 2019
69eec09
general functions test fixes
nikic Mar 7, 2019
8e5a097
More string test fixes
nikic Mar 7, 2019
c3b19ec
More general functions test fixes
nikic Mar 7, 2019
9e590e7
Partial
nikic Mar 7, 2019
4ce6877
Math test fixes
nikic Mar 7, 2019
c1845f5
Stream test fixes
nikic Mar 7, 2019
98dce51
Misc test fixes
nikic Mar 7, 2019
5fd6079
Misc test updates
nikic Mar 8, 2019
1fd8ec5
mysqli test updates
nikic Mar 8, 2019
784762c
file test fixes
nikic Mar 8, 2019
7ae628a
Misc test updates
nikic Mar 8, 2019
d001b6a
Fix pgsql tests
nikic Mar 8, 2019
e182baa
Misc test fixes
nikic Mar 8, 2019
21853d0
Misc test updates
nikic Mar 8, 2019
30635d1
Misc fixes
nikic Mar 8, 2019
7d10143
Don't use custom soap error handling during zpp
nikic Mar 8, 2019
cfaecfb
Fix soap tests
nikic Mar 8, 2019
b7612d7
Remove zend_internal_type_error use in win32 specific code
nikic Mar 8, 2019
8f40d39
Use placeholder
nikic Mar 8, 2019
adc65e5
Try to fix windows tests
nikic Mar 8, 2019
d2ddf35
Fix more win32 tests
nikic Mar 11, 2019
5e4d9ba
Fix m32 tests
nikic Mar 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions Zend/tests/004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ strncmp() tests
--FILE--
<?php

var_dump(strncmp("", ""));
var_dump(strncmp("", "", 100));
var_dump(strncmp("aef", "dfsgbdf", -1));
var_dump(strncmp("fghjkl", "qwer", 0));
Expand All @@ -13,8 +12,6 @@ var_dump(strncmp("qwerty", "qwerty123", 7));
echo "Done\n";
?>
--EXPECTF--
Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d
NULL
int(0)

Warning: Length must be greater than or equal to 0 in %s on line %d
Expand Down
3 changes: 0 additions & 3 deletions Zend/tests/005.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ strcasecmp() tests
--FILE--
<?php

var_dump(strcasecmp(""));
var_dump(strcasecmp("", ""));
var_dump(strcasecmp("aef", "dfsgbdf"));
var_dump(strcasecmp("qwe", "qwer"));
Expand All @@ -15,8 +14,6 @@ var_dump(strcasecmp("01", "01"));
echo "Done\n";
?>
--EXPECTF--
Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d
NULL
int(0)
int(-3)
int(-1)
Expand Down
4 changes: 0 additions & 4 deletions Zend/tests/006.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ strncasecmp() tests
--FILE--
<?php

var_dump(strncasecmp(""));
var_dump(strncasecmp("", "", -1));
var_dump(strncasecmp("aef", "dfsgbdf", 0));
var_dump(strncasecmp("aef", "dfsgbdf", 10));
Expand All @@ -16,9 +15,6 @@ var_dump(strncasecmp("01", "01", 1000));
echo "Done\n";
?>
--EXPECTF--
Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d
NULL

Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
int(0)
Expand Down
23 changes: 7 additions & 16 deletions Zend/tests/008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ define() tests
--FILE--
<?php

var_dump(define());
var_dump(define("TRUE"));
var_dump(define("TRUE", 1));
var_dump(define("TRUE", 1, array(1)));
try {
var_dump(define(array(1,2,3,4,5), 1));
} catch (TypeError $e) {
echo "TypeError: ", $e->getMessage(), "\n";
}

var_dump(define(array(1,2,3,4,5), 1));
var_dump(define("TRUE", 1));
var_dump(define(" ", 1));
var_dump(define("[[[", 2));
var_dump(define("test const", 3));
Expand All @@ -24,20 +25,10 @@ var_dump(constant("test const"));
echo "Done\n";
?>
--EXPECTF--
Warning: define() expects at least 2 parameters, 0 given in %s on line %d
NULL

Warning: define() expects at least 2 parameters, 1 given in %s on line %d
NULL
TypeError: define() expects parameter 1 to be string, array given

Notice: Constant TRUE already defined in %s on line %d
bool(false)

Warning: define() expects parameter 3 to be bool, array given in %s on line %d
NULL

Warning: define() expects parameter 1 to be string, array given in %s on line %d
NULL
bool(true)
bool(true)
bool(true)
Expand Down
7 changes: 0 additions & 7 deletions Zend/tests/011.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class bar extends foo {
}
}

var_dump(property_exists());
var_dump(property_exists(""));
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
Expand Down Expand Up @@ -53,11 +51,6 @@ $bar->test();
echo "Done\n";
?>
--EXPECTF--
Warning: property_exists() expects exactly 2 parameters, 0 given in %s on line %d
NULL

Warning: property_exists() expects exactly 2 parameters, 1 given in %s on line %d
NULL
bool(true)
bool(true)
bool(true)
Expand Down
9 changes: 1 addition & 8 deletions Zend/tests/012.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ class_exists() tests
class foo {
}

var_dump(class_exists());
var_dump(class_exists("qwerty"));
var_dump(class_exists(""));
var_dump(class_exists(array()));
var_dump(class_exists("test", false));
var_dump(class_exists("foo", false));
var_dump(class_exists("foo"));
Expand All @@ -18,14 +16,9 @@ var_dump(class_exists("stdClass"));

echo "Done\n";
?>
--EXPECTF--
Warning: class_exists() expects at least 1 parameter, 0 given in %s on line %d
NULL
--EXPECT--
bool(false)
bool(false)

Warning: class_exists() expects parameter 1 to be string, array given in %s on line %d
NULL
bool(false)
bool(true)
bool(true)
Expand Down
9 changes: 1 addition & 8 deletions Zend/tests/013.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ interface_exists() tests
interface foo {
}

var_dump(interface_exists());
var_dump(interface_exists("qwerty"));
var_dump(interface_exists(""));
var_dump(interface_exists(array()));
var_dump(interface_exists("test", false));
var_dump(interface_exists("foo", false));
var_dump(interface_exists("foo"));
Expand All @@ -18,14 +16,9 @@ var_dump(interface_exists("stdClass"));

echo "Done\n";
?>
--EXPECTF--
Warning: interface_exists() expects at least 1 parameter, 0 given in %s on line %d
NULL
--EXPECT--
bool(false)
bool(false)

Warning: interface_exists() expects parameter 1 to be string, array given in %s on line %d
NULL
bool(false)
bool(true)
bool(true)
Expand Down
10 changes: 0 additions & 10 deletions Zend/tests/014.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ var_dump(get_included_files());
include(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());

var_dump(get_included_files(1,1));

include_once(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());

var_dump(get_included_files(1));

include(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());

Expand All @@ -31,18 +27,12 @@ array(2) {
[1]=>
string(%d) "%s"
}

Warning: get_included_files() expects exactly 0 parameters, 2 given in %s on line %d
NULL
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}

Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d
NULL
array(2) {
[0]=>
string(%d) "%s"
Expand Down
8 changes: 0 additions & 8 deletions Zend/tests/015.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ trigger_error() tests
--FILE--
<?php

var_dump(trigger_error());
var_dump(trigger_error("error"));
var_dump(trigger_error(array()));
var_dump(trigger_error("error", -1));
var_dump(trigger_error("error", 0));
var_dump(trigger_error("error", E_USER_WARNING));
Expand All @@ -14,15 +12,9 @@ var_dump(trigger_error("error", E_USER_DEPRECATED));
echo "Done\n";
?>
--EXPECTF--
Warning: trigger_error() expects at least 1 parameter, 0 given in %s on line %d
NULL

Notice: error in %s on line %d
bool(true)

Warning: trigger_error() expects parameter 1 to be string, array given in %s on line %d
NULL

Warning: Invalid error type specified in %s on line %d
bool(false)

Expand Down
23 changes: 0 additions & 23 deletions Zend/tests/017.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ builtin functions tests
--FILE--
<?php

var_dump(get_resource_type());
var_dump(get_resource_type(""));
$fp = fopen(__FILE__, "r");
var_dump(get_resource_type($fp));
fclose($fp);
Expand All @@ -14,11 +12,9 @@ var_dump(gettype(get_loaded_extensions()));
var_dump(count(get_loaded_extensions()));
var_dump(gettype(get_loaded_extensions(true)));
var_dump(count(get_loaded_extensions(true)));
var_dump(get_loaded_extensions(true, true));

define("USER_CONSTANT", "test");

var_dump(get_defined_constants(true, true));
var_dump(gettype(get_defined_constants(true)));
var_dump(gettype(get_defined_constants()));
var_dump(count(get_defined_constants()));
Expand All @@ -29,11 +25,9 @@ function test () {
var_dump(gettype(get_defined_functions()));
var_dump(count(get_defined_functions()));

var_dump(get_declared_interfaces(true));
var_dump(gettype(get_declared_interfaces()));
var_dump(count(get_declared_interfaces()));

var_dump(get_extension_funcs());
var_dump(get_extension_funcs(true));
var_dump(gettype(get_extension_funcs("standard")));
var_dump(count(get_extension_funcs("standard")));
Expand All @@ -44,36 +38,19 @@ var_dump(count(get_extension_funcs("zend")));
echo "Done\n";
?>
--EXPECTF--
Warning: get_resource_type() expects exactly 1 parameter, 0 given in %s on line %d
NULL

Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d
NULL
string(6) "stream"
string(7) "Unknown"
string(5) "array"
int(%d)
string(5) "array"
int(%d)

Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in %s on line %d
NULL

Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line %d
NULL
string(5) "array"
string(5) "array"
int(%d)
string(5) "array"
int(%d)

Warning: get_declared_interfaces() expects exactly 0 parameters, 1 given in %s on line %d
NULL
string(5) "array"
int(%d)

Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d
NULL
bool(false)
string(5) "array"
int(%d)
Expand Down
13 changes: 0 additions & 13 deletions Zend/tests/018.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ constant() tests
--FILE--
<?php

var_dump(constant());
var_dump(constant("", ""));
var_dump(constant(""));

var_dump(constant(array()));

define("TEST_CONST", 1);
var_dump(constant("TEST_CONST"));

Expand All @@ -18,17 +14,8 @@ var_dump(constant("TEST_CONST2"));
echo "Done\n";
?>
--EXPECTF--
Warning: constant() expects exactly 1 parameter, 0 given in %s on line %d
NULL

Warning: constant() expects exactly 1 parameter, 2 given in %s on line %d
NULL

Warning: constant(): Couldn't find constant in %s on line %d
NULL

Warning: constant() expects parameter 1 to be string, array given in %s on line %d
NULL
int(1)
string(4) "test"
Done
8 changes: 0 additions & 8 deletions Zend/tests/020.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ func_get_arg() invalid usage
--FILE--
<?php

var_dump(func_get_arg(1,2,3));
var_dump(func_get_arg(1));
var_dump(func_get_arg());

function bar() {
var_dump(func_get_arg(1));
Expand All @@ -20,15 +18,9 @@ foo(1,2);
echo "Done\n";
?>
--EXPECTF--
Warning: func_get_arg() expects exactly 1 parameter, 3 given in %s on line %d
NULL

Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
bool(false)

Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d
NULL

Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
Done
9 changes: 6 additions & 3 deletions Zend/tests/bug31720.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ Bug #31720 (Invalid object callbacks not caught in array_walk())
<?php
$array = array('at least one element');

array_walk($array, array($nonesuchvar,'show'));
try {
array_walk($array, array($nonesuchvar,'show'));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
===DONE===
--EXPECTF--
Notice: Undefined variable: nonesuchvar in %s on line %d

Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d
array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object
===DONE===
11 changes: 7 additions & 4 deletions Zend/tests/bug45186.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ $x->test();

call_user_func(array('BAR','x'));
call_user_func('BAR::www');
call_user_func('self::y');
try {
call_user_func('self::y');
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}

?>
--EXPECTF--
--EXPECT--
__call:
string(3) "ABC"
__call:
Expand All @@ -50,5 +54,4 @@ string(1) "y"
ok
__callstatic:
string(3) "www"

Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active in %sbug45186.php on line 31
call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active
Loading