From 06954d1bc1966ade0815db3f4ec8983b954950c1 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 20 Oct 2013 22:32:20 -0700 Subject: fix const warnings in intl methods --- ext/intl/msgformat/msgformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/intl/msgformat/msgformat.c') diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 6a9f04f32b..7d8cd958e3 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -28,7 +28,7 @@ /* {{{ */ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char* locale; + const char* locale; char* pattern; int locale_len = 0, pattern_len = 0; UChar* spattern = NULL; -- cgit v1.2.1 From 4fbaddb4f8b041769bea7efdd12313641387bd14 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 28 Jun 2014 00:02:50 +0800 Subject: Refactoring ext/intl (incompleted) --- ext/intl/msgformat/msgformat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/intl/msgformat/msgformat.c') diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 7d8cd958e3..2a5af418e0 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -130,7 +130,7 @@ PHP_FUNCTION( msgfmt_get_error_code ) RETURN_FALSE; } - mfo = (MessageFormatter_object *) zend_object_store_get_object( object TSRMLS_CC ); + mfo = Z_INTL_MESSAGEFORMATTER_P( object ); /* Return formatter's last error code. */ RETURN_LONG( INTL_DATA_ERROR_CODE(mfo) ); @@ -144,7 +144,7 @@ PHP_FUNCTION( msgfmt_get_error_code ) */ PHP_FUNCTION( msgfmt_get_error_message ) { - char* message = NULL; + zend_string* message = NULL; zval* object = NULL; MessageFormatter_object* mfo = NULL; @@ -158,11 +158,11 @@ PHP_FUNCTION( msgfmt_get_error_message ) RETURN_FALSE; } - mfo = (MessageFormatter_object *) zend_object_store_get_object( object TSRMLS_CC ); + mfo = Z_INTL_MESSAGEFORMATTER_P( object ); /* Return last error message. */ message = intl_error_get_message( &mfo->mf_data.error TSRMLS_CC ); - RETURN_STRING( message, 0); + RETURN_STR(message); } /* }}} */ -- cgit v1.2.1 From e1437022e188747495badcfa2b86282456bc27e8 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 29 Jun 2014 00:29:07 +0800 Subject: Fixed segfault, segfault and segfault --- ext/intl/msgformat/msgformat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ext/intl/msgformat/msgformat.c') diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 2a5af418e0..853907ce3d 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -44,8 +44,8 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "msgfmt_create: unable to parse input parameters", 0 TSRMLS_CC ); - zval_dtor(return_value); - RETURN_NULL(); + Z_OBJ_P(return_value) == NULL; + return; } INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); @@ -97,6 +97,9 @@ PHP_FUNCTION( msgfmt_create ) { object_init_ex( return_value, MessageFormatter_ce_ptr ); msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { + RETURN_NULL(); + } } /* }}} */ -- cgit v1.2.1 From ca414c69040c66642b38d9f3aebe343265adc3f5 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 9 Jul 2014 00:15:27 +0400 Subject: Typo --- ext/intl/msgformat/msgformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/intl/msgformat/msgformat.c') diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 853907ce3d..62999436c2 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -44,7 +44,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "msgfmt_create: unable to parse input parameters", 0 TSRMLS_CC ); - Z_OBJ_P(return_value) == NULL; + Z_OBJ_P(return_value) = NULL; return; } -- cgit v1.2.1 From 1dd07d6bf438a6a60f2fefcdd7e5c45045ef88f9 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 9 Jul 2014 11:57:42 +0400 Subject: 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(). --- ext/intl/msgformat/msgformat.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ext/intl/msgformat/msgformat.c') diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 62999436c2..b9f6c7a369 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -108,8 +108,16 @@ PHP_FUNCTION( msgfmt_create ) */ PHP_METHOD( MessageFormatter, __construct ) { + zval orig_this = *getThis(); + return_value = getThis(); msgfmt_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(); + } } /* }}} */ -- cgit v1.2.1 From 63d3f0b844b3a5f1c94be3c97bca29235dc2b3fc Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 19 Aug 2014 08:07:31 +0200 Subject: basic macro replacements, all at once --- ext/intl/msgformat/msgformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/intl/msgformat/msgformat.c') diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index b9f6c7a369..cfe6538f0a 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -144,7 +144,7 @@ PHP_FUNCTION( msgfmt_get_error_code ) mfo = Z_INTL_MESSAGEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_LONG( INTL_DATA_ERROR_CODE(mfo) ); + RETURN_INT( INTL_DATA_ERROR_CODE(mfo) ); } /* }}} */ -- cgit v1.2.1 From c3e3c98ec666812daaaca896cf5ef758a8a6df14 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 25 Aug 2014 19:24:55 +0200 Subject: master renames phase 1 --- ext/intl/msgformat/msgformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/intl/msgformat/msgformat.c') diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index cfe6538f0a..b9f6c7a369 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -144,7 +144,7 @@ PHP_FUNCTION( msgfmt_get_error_code ) mfo = Z_INTL_MESSAGEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_INT( INTL_DATA_ERROR_CODE(mfo) ); + RETURN_LONG( INTL_DATA_ERROR_CODE(mfo) ); } /* }}} */ -- cgit v1.2.1 From 3234480827b27ff5d3469a732167afd289632a96 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 27 Aug 2014 15:31:48 +0200 Subject: first show to make 's' work with size_t --- ext/intl/msgformat/msgformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/intl/msgformat/msgformat.c') diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index b9f6c7a369..b42d87967e 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -30,7 +30,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { const char* locale; char* pattern; - int locale_len = 0, pattern_len = 0; + size_t locale_len = 0, pattern_len = 0; UChar* spattern = NULL; int spattern_len = 0; zval* object; -- cgit v1.2.1 From d0cb715373c3fbe9dc095378ec5ed8c71f799f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Fri, 19 Sep 2014 18:33:14 +0200 Subject: s/PHP 5/PHP 7/ --- ext/intl/msgformat/msgformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/intl/msgformat/msgformat.c') diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index b42d87967e..2ca8ed9186 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -1,6 +1,6 @@ /* +----------------------------------------------------------------------+ - | PHP Version 5 | + | PHP Version 7 | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | -- cgit v1.2.1