diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-07-09 11:57:42 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-07-09 11:57:42 +0400 |
commit | 1dd07d6bf438a6a60f2fefcdd7e5c45045ef88f9 (patch) | |
tree | 9819118878bd35afd815a7aad1ea84da8e6b50bc /ext/intl/collator/collator_create.c | |
parent | ca414c69040c66642b38d9f3aebe343265adc3f5 (diff) | |
download | php-git-1dd07d6bf438a6a60f2fefcdd7e5c45045ef88f9.tar.gz |
Partial fix that allows internal constructors to set $this to null.
The address of $this passed to drectly called internal constructor in execute_data->return_value.
Internal constructors should use ZEND_CTOR_MAKE_NULL() macro (insted of previous ZEND_NULL(EG(This))) to do the work.
This patch doesn't fix the problem for indirectly called constructors. e.g. parant::__construct().
Diffstat (limited to 'ext/intl/collator/collator_create.c')
-rw-r--r-- | ext/intl/collator/collator_create.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index 7ed4c53439..5801a68d0d 100644 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -72,8 +72,16 @@ PHP_FUNCTION( collator_create ) */ PHP_METHOD( Collator, __construct ) { + zval orig_this = *getThis(); + return_value = getThis(); collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + + if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { + zend_object_store_ctor_failed(Z_OBJ(orig_this) TSRMLS_CC); + zval_dtor(&orig_this); + ZEND_CTOR_MAKE_NULL(); + } } /* }}} */ |