diff options
author | Gustavo Lopes <glopes@nebm.ist.utl.pt> | 2012-08-26 23:44:54 +0200 |
---|---|---|
committer | Gustavo Lopes <glopes@nebm.ist.utl.pt> | 2012-08-26 23:44:54 +0200 |
commit | dacd11ea8989a442032b9fdbece581cf9d299904 (patch) | |
tree | 862ca0cc53e80d66b485042a767fe07e946cbc59 | |
parent | befe4ab479a615298d93332b15ebcc69cee426bb (diff) | |
download | php-git-dacd11ea8989a442032b9fdbece581cf9d299904.tar.gz |
Fixed cloning in ext/intl classes; master specific
-rw-r--r-- | ext/intl/tests/bug62915.phpt | 24 | ||||
-rw-r--r-- | ext/intl/timezone/timezone_class.cpp | 2 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ext/intl/tests/bug62915.phpt b/ext/intl/tests/bug62915.phpt new file mode 100644 index 0000000000..e541d72d63 --- /dev/null +++ b/ext/intl/tests/bug62915.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #62915: incomplete cloning of IntlTimeZone objects +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php + +class foo extends IntlTimeZone { + public $foo = 'test'; + + public function __construct() { } +} + +$x = new foo; + +try { + $z = clone $x; +} catch (Exception $e) { + var_dump($e->getMessage()); +} +--EXPECT-- +string(39) "Cannot clone unconstructed IntlTimeZone" diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 27cf41a4cf..374b163851 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -225,7 +225,7 @@ static zend_object_value TimeZone_clone_obj(zval *object TSRMLS_DC) to_orig = (TimeZone_object*)zend_object_store_get_object(object TSRMLS_CC); intl_error_reset(TIMEZONE_ERROR_P(to_orig) TSRMLS_CC); - ret_val = TimeZone_ce_ptr->create_object(TimeZone_ce_ptr TSRMLS_CC); + ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); to_new = (TimeZone_object*)zend_object_store_get_object_by_handle( ret_val.handle TSRMLS_CC); |