com php-src: Fixed cloning in ext/intl classes; master specific: ext/intl/tests/bug62915.phpt ext/intl/timezone/timezone_class .cpp
| From: | Gustavo André dos Santos Lopes | Date: | Sun, 26 Aug 2012 21:44:54 +0000 |
| Subject: | com php-src: Fixed cloning in ext/intl classes; master specific: ext/intl/tests/bug62915.phpt ext/intl/timezone/timezone_class .cpp | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-69984@lists.php.net to get a copy of this message | ||
Commit: dacd11ea8989a442032b9fdbece581cf9d299904
Author: Gustavo Lopes <glopes@nebm.ist.utl.pt> Sun, 26 Aug 2012 23:44:54 +0200
Parents: befe4ab479a615298d93332b15ebcc69cee426bb
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dacd11ea8989a442032b9fdbece581cf9d299904
Log:
Fixed cloning in ext/intl classes; master specific
Changed paths:
A ext/intl/tests/bug62915.phpt
M ext/intl/timezone/timezone_class.cpp
Diff:
diff --git a/ext/intl/tests/bug62915.phpt b/ext/intl/tests/bug62915.phpt
new file mode 100644
index 0000000..e541d72
--- /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 27cf41a..374b163 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);