Permalink
Browse files

Fixed cloning in ext/intl classes; master specific

  • Loading branch information...
1 parent befe4ab commit dacd11ea8989a442032b9fdbece581cf9d299904 @cataphract cataphract committed Aug 26, 2012
Showing with 25 additions and 1 deletion.
  1. +24 −0 ext/intl/tests/bug62915.phpt
  2. +1 −1 ext/intl/timezone/timezone_class.cpp
View
24 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"
View
2 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);

0 comments on commit dacd11e

Please sign in to comment.