Skip to content

Commit cd1f45b

Browse files
committed
Fix handling of several uinitialized intl objects
PHP 5.4 specific changes. Not having this in the merge commit helps porting to pecl/intl
1 parent 87803ac commit cd1f45b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

ext/intl/spoofchecker/spoofchecker_class.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ extern zend_class_entry *Spoofchecker_ce_ptr;
5555
Spoofchecker_object* co = NULL; \
5656
intl_error_reset(NULL TSRMLS_CC); \
5757

58+
#define SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(Spoofchecker, co)
59+
#define SPOOFCHECKER_METHOD_FETCH_OBJECT \
60+
SPOOFCHECKERMETHOD_FETCH_OBJECT_NO_CHECK; \
61+
if (co->uspoof == NULL) { \
62+
intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, \
63+
"Found unconstructed Spoofchecker", 0 TSRMLS_CC); \
64+
RETURN_FALSE; \
65+
}
66+
5867
#define SPOOFCHECKER_METHOD_FETCH_OBJECT \
5968
co = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC); \
6069
intl_error_reset(SPOOFCHECKER_ERROR_P(co) TSRMLS_CC); \

ext/intl/spoofchecker/spoofchecker_create.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ PHP_METHOD(Spoofchecker, __construct)
3535
return;
3636
}
3737

38-
SPOOFCHECKER_METHOD_FETCH_OBJECT;
38+
SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK;
3939

4040
co->uspoof = uspoof_open(SPOOFCHECKER_ERROR_CODE_P(co));
4141
INTL_CTOR_CHECK_STATUS(co, "spoofchecker: unable to open ICU Spoof Checker");

0 commit comments

Comments
 (0)