summaryrefslogtreecommitdiff
path: root/ext/intl/formatter/formatter_main.c
diff options
context:
space:
mode:
authorStanley Sufficool <ssufficool@php.net>2014-10-20 21:33:32 -0700
committerStanley Sufficool <ssufficool@php.net>2014-10-20 21:33:32 -0700
commit8defcb855ab01d9c8ab4759cb793d80149b55a8c (patch)
treeed51eb30a2cbc92b102557498fb3e4113da1bb07 /ext/intl/formatter/formatter_main.c
parent9c7dbb0487f5991fde03873ea8f5e66d6688415f (diff)
parentbaddb1c73a170ef1d2c31bd54cddbc6e1ab596b9 (diff)
downloadphp-git-8defcb855ab01d9c8ab4759cb793d80149b55a8c.tar.gz
Merge branch 'master' of https://git.php.net/push/php-src
* 'master' of https://git.php.net/push/php-src: (6215 commits) Extra comma Moved proxy object support in ASSIGN_ADD (and family) from VM to slow paths of corresponding operators Simplification zend_get_property_info_quick() cleanup and optimization initialize lineno before calling compile file file in phar Use ADDREF instead of DUP, it must be enough. Removed old irrelevant comment fixed compilation error Fix bug #68262: Broken reference across cloned objects export functions needed for phpdbg Fixed compilation Optimized property access handlers. Removed EG(std_property_info). Fixed bug #68199 (PDO::pgsqlGetNotify doesn't support NOTIFY payloads) Don't make difference between undefined and unaccessible properies when call __get() and family Don't make useless CSE array_pop/array_shift optimization check for zlib headers as well as lib for mysqlnd a realpath cache key can be int or float, catching this News entry for new curl constants News entry for new curl constants ...
Diffstat (limited to 'ext/intl/formatter/formatter_main.c')
-rw-r--r--ext/intl/formatter/formatter_main.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c
index d0671a88b5..939a8f782b 100644
--- a/ext/intl/formatter/formatter_main.c
+++ b/ext/intl/formatter/formatter_main.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 |
@@ -27,10 +27,10 @@
/* {{{ */
static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
- char* locale;
+ const char* locale;
char* pattern = NULL;
- int locale_len = 0, pattern_len = 0;
- long style;
+ size_t locale_len = 0, pattern_len = 0;
+ zend_long style;
UChar* spattern = NULL;
int spattern_len = 0;
FORMATTER_METHOD_INIT_VARS;
@@ -41,8 +41,8 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"numfmt_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);
@@ -79,6 +79,9 @@ PHP_FUNCTION( numfmt_create )
{
object_init_ex( return_value, NumberFormatter_ce_ptr );
numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) {
+ RETURN_NULL();
+ }
}
/* }}} */
@@ -87,8 +90,16 @@ PHP_FUNCTION( numfmt_create )
*/
PHP_METHOD( NumberFormatter, __construct )
{
+ zval orig_this = *getThis();
+
return_value = getThis();
numfmt_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();
+ }
}
/* }}} */
@@ -111,7 +122,7 @@ PHP_FUNCTION( numfmt_get_error_code )
RETURN_FALSE;
}
- nfo = (NumberFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
+ nfo = Z_INTL_NUMBERFORMATTER_P(object);
/* Return formatter's last error code. */
RETURN_LONG( INTL_DATA_ERROR_CODE(nfo) );
@@ -125,7 +136,7 @@ PHP_FUNCTION( numfmt_get_error_code )
*/
PHP_FUNCTION( numfmt_get_error_message )
{
- char* message = NULL;
+ zend_string *message = NULL;
FORMATTER_METHOD_INIT_VARS
/* Parse parameters. */
@@ -138,11 +149,11 @@ PHP_FUNCTION( numfmt_get_error_message )
RETURN_FALSE;
}
- nfo = (NumberFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
+ nfo = Z_INTL_NUMBERFORMATTER_P(object);
/* Return last error message. */
message = intl_error_get_message( INTL_DATA_ERROR_P(nfo) TSRMLS_CC );
- RETURN_STRING( message, 0);
+ RETURN_STR(message);
}
/* }}} */