From 949f6cd47312cdaa1603025af6bdd8e0ec6c425f Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 22:01:15 +0200 Subject: [PATCH 1/4] Announce on NEWS change in 1ce572c --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index f5b5fe05f6b72..5cd11c8696f1f 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,9 @@ PHP NEWS . Fixed bug #62852 (Unserialize invalid DateTime causes crash). (reeze.xia@gmail.com) +- Intl: + . Fix bug #62933 (ext/intl compilation error on icu 3.4.1). (Gustavo) + - Installation: . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia) From 72c807ad67f07ec391017f90771c2e9beb5dbed7 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:30:43 +0200 Subject: [PATCH 2/4] Allow Spoofchecker to be registered on ICU 49.1 --- ext/intl/php_intl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index efe0ddd242319..90e3573c1b51d 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -70,7 +70,7 @@ #include "idn/idn.h" -#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2 +#if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002 # include "spoofchecker/spoofchecker_class.h" # include "spoofchecker/spoofchecker.h" # include "spoofchecker/spoofchecker_create.h" @@ -646,7 +646,7 @@ PHP_MINIT_FUNCTION( intl ) /* Expose IDN constants to PHP scripts. */ idn_register_constants(INIT_FUNC_ARGS_PASSTHRU); -#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2 +#if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002 /* Register 'Spoofchecker' PHP class */ spoofchecker_register_Spoofchecker_class( TSRMLS_C ); From 63a1801d195441bc681ff20ecf9dddac787824d8 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:39:53 +0200 Subject: [PATCH 3/4] NEWS for commit 72c807a --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 5cd11c8696f1f..2ecbb91f26b84 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,7 @@ PHP NEWS (reeze.xia@gmail.com) - Intl: + . Fixed Spoofchecker not being registered on ICU 49.1. (Gustavo) . Fix bug #62933 (ext/intl compilation error on icu 3.4.1). (Gustavo) - Installation: From 886a50a619e55c9c1a5597449d6c71c69ff6fef8 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:37:09 +0200 Subject: [PATCH 4/4] Fixed defective cloning in ext/intl classes See also bug #62915 --- ext/intl/dateformat/dateformat_class.c | 2 +- ext/intl/formatter/formatter_class.c | 2 +- ext/intl/msgformat/msgformat_class.c | 2 +- ext/intl/spoofchecker/spoofchecker_class.c | 2 +- ext/intl/tests/bug62915-2.phpt | 33 +++++++++++++++++++ .../transliterator/transliterator_class.c | 2 +- 6 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 ext/intl/tests/bug62915-2.phpt diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index 801ca3379e38f..49f316f7876c6 100644 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -92,7 +92,7 @@ zend_object_value IntlDateFormatter_object_clone(zval *object TSRMLS_DC) DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj_val = IntlDateFormatter_ce_ptr->create_object(IntlDateFormatter_ce_ptr TSRMLS_CC); + new_obj_val = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_dfo = (IntlDateFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_dfo->zo, new_obj_val, &dfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index 8f399a67735b8..2246cd29a5ce9 100644 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -86,7 +86,7 @@ zend_object_value NumberFormatter_object_clone(zval *object TSRMLS_DC) NumberFormatter_object *nfo, *new_nfo; FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj_val = NumberFormatter_ce_ptr->create_object(NumberFormatter_ce_ptr TSRMLS_CC); + new_obj_val = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_nfo = (NumberFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_nfo->zo, new_obj_val, &nfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index da1e1e595a763..bb3b55f39c615 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -84,7 +84,7 @@ zend_object_value MessageFormatter_object_clone(zval *object TSRMLS_DC) MessageFormatter_object *mfo, *new_mfo; MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj_val = MessageFormatter_ce_ptr->create_object(MessageFormatter_ce_ptr TSRMLS_CC); + new_obj_val = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_mfo = (MessageFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_mfo->zo, new_obj_val, &mfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c index 507a2ca98e5b3..6c2b79034df73 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -127,7 +127,7 @@ static zend_object_value spoofchecker_clone_obj(zval *object TSRMLS_DC) /* {{{ * sfo = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC); intl_error_reset(SPOOFCHECKER_ERROR_P(sfo) TSRMLS_CC); - new_obj_val = Spoofchecker_ce_ptr->create_object(Spoofchecker_ce_ptr TSRMLS_CC); + new_obj_val = Spoofchecker_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_sfo = (Spoofchecker_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_sfo->zo, new_obj_val, &sfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/tests/bug62915-2.phpt b/ext/intl/tests/bug62915-2.phpt new file mode 100644 index 0000000000000..bcb069cab6842 --- /dev/null +++ b/ext/intl/tests/bug62915-2.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #62915: cloning of several classes is defective +--SKIPIF-- +newInstanceArgs($subclass::$ARGS); + $clone = clone $obj; + var_dump(get_class($clone)); +} +--EXPECT-- +string(1) "A" +string(1) "B" +string(1) "C" +string(1) "D" diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index 8d4d0649e97e5..5ef80fb482ce9 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -162,7 +162,7 @@ static zend_object_value Transliterator_clone_obj( zval *object TSRMLS_DC ) to_orig = zend_object_store_get_object( object TSRMLS_CC ); intl_error_reset( INTL_DATA_ERROR_P( to_orig ) TSRMLS_CC ); - ret_val = Transliterator_ce_ptr->create_object( Transliterator_ce_ptr TSRMLS_CC ); + ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) TSRMLS_CC ); to_new = zend_object_store_get_object_by_handle( ret_val.handle TSRMLS_CC ); zend_objects_clone_members( &to_new->zo, ret_val,