Fixed cloning in ext/intl classes; master specific

This commit is contained in:
Gustavo Lopes 2012-08-26 23:44:54 +02:00
parent befe4ab479
commit dacd11ea89
2 changed files with 25 additions and 1 deletions

View File

@ -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 File

@ -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);