diff options
author | Nikita Popov <nikic@php.net> | 2015-04-02 18:52:32 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-04-06 11:27:34 +0200 |
commit | 122d759618a42bff105971b923fbbb5be02e34b9 (patch) | |
tree | fd4487414ffa3f120c77b19b9eb7dc409659c57e /ext/snmp/snmp.c | |
parent | 884b0365dbe718f667d048dbc3d1cd9d9f12ab84 (diff) | |
download | php-git-122d759618a42bff105971b923fbbb5be02e34b9.tar.gz |
Always throw TypeException on throwing zpp failures
Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to
report FAILURE errors using a TypeException instead of a Warning,
like it would happen in strict mode.
Adds a zend_parse_parameters_throw() convenience function, which
invokes zpp with this flag.
Converts all cases I could identify, where we currently have
throwing zpp usage in constructors and replaces them with this API.
Error handling is still replaced to EH_THROW in some cases to handle
other, domain-specific errors in constructors.
Diffstat (limited to 'ext/snmp/snmp.c')
-rw-r--r-- | ext/snmp/snmp.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 8e89c4d4f9..5f34ac4fcb 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1807,19 +1807,14 @@ PHP_METHOD(snmp, __construct) zend_long retries = SNMP_DEFAULT_RETRIES; zend_long version = SNMP_DEFAULT_VERSION; int argc = ZEND_NUM_ARGS(); - zend_error_handling error_handling; snmp_object = Z_SNMP_P(object); - zend_replace_error_handling(EH_THROW, NULL, &error_handling); - if (zend_parse_parameters(argc, "lss|ll", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) { - zend_restore_error_handling(&error_handling); + if (zend_parse_parameters_throw(argc, "lss|ll", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) { return; } - zend_restore_error_handling(&error_handling); - - switch(version) { + switch (version) { case SNMP_VERSION_1: case SNMP_VERSION_2c: case SNMP_VERSION_3: |