Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'PHP-5.4'

* PHP-5.4:
  Fixed defective cloning in ext/intl classes
  NEWS for commit 72c807a
  Allow Spoofchecker to be registered on ICU 49.1
  Announce on NEWS change in 1ce572c
  • Loading branch information...
commit befe4ab479a615298d93332b15ebcc69cee426bb 2 parents 011af74 + 886a50a
@cataphract cataphract authored
View
2  ext/intl/dateformat/dateformat_class.c
@@ -94,7 +94,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);
View
2  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);
View
2  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);
View
4 ext/intl/php_intl.c
@@ -84,7 +84,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"
@@ -963,7 +963,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 );
View
2  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);
View
33 ext/intl/tests/bug62915-2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #62915: cloning of several classes is defective
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+class A extends IntlDateFormatter {
+ static $ARGS = array("en_US" ,IntlDateFormatter::FULL, IntlDateFormatter::FULL,
+ 'America/Los_Angeles', IntlDateFormatter::GREGORIAN);
+}
+class B extends NumberFormatter {
+ static $ARGS = array('de_DE', NumberFormatter::DECIMAL);
+}
+class C extends MessageFormatter {
+ static $ARGS = array("en_US", "foo");
+}
+class D extends Spoofchecker {
+ static $ARGS = array();
+}
+
+foreach (range('A', 'D') as $subclass) {
+ $rc = new ReflectionClass($subclass);
+ $obj = $rc->newInstanceArgs($subclass::$ARGS);
+ $clone = clone $obj;
+ var_dump(get_class($clone));
+}
+--EXPECT--
+string(1) "A"
+string(1) "B"
+string(1) "C"
+string(1) "D"
View
2  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,
Please sign in to comment.
Something went wrong with that request. Please try again.