com php-src: Made UConverter throw an exception if the constructor fails.: ext/intl/converter/converter.c
| From: | Dmitry Stogov | Date: | Sun, 15 Mar 2015 15:30:25 +0000 |
| Subject: | com php-src: Made UConverter throw an exception if the constructor fails.: ext/intl/converter/converter.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85999@lists.php.net to get a copy of this message | ||
Commit: 9803fccfbc1022e29dc89d04fcd3618ddf0c60ec
Author: Danack <Danack@basereality.com> Sun, 15 Mar 2015 15:30:25 +0000
Parents: d3267d0092a09eb3a0da2bd953ad21cf5bae325a
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9803fccfbc1022e29dc89d04fcd3618ddf0c60ec
Log:
Made UConverter throw an exception if the constructor fails.
Changed paths:
M ext/intl/converter/converter.c
Diff:
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index 9bba427..3b830bd 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -22,6 +22,7 @@
#include <unicode/ustring.h>
#include "../intl_error.h"
+#include "../intl_common.h"
typedef struct _php_converter_object {
UConverter *src, *dest;
@@ -556,11 +557,17 @@ static PHP_METHOD(UConverter, __construct) {
size_t src_len = sizeof("utf-8") - 1;
char *dest = src;
size_t dest_len = src_len;
+ zend_error_handling zeh;
+ int rv;
intl_error_reset(NULL);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!",
- &dest, &dest_len, &src, &src_len) == FAILURE) {
+ zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &zeh TSRMLS_CC);
+ rv = zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!",
+ &dest, &dest_len, &src, &src_len);
+ zend_restore_error_handling(&zeh TSRMLS_CC);
+
+ if (rv == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"UConverter::__construct(): bad arguments", 0);
return;