Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed cloning in ext/intl classes; master specific

  • Loading branch information...
commit dacd11ea8989a442032b9fdbece581cf9d299904 1 parent befe4ab
Gustavo Lopes authored August 26, 2012
24  ext/intl/tests/bug62915.phpt
... ...
@@ -0,0 +1,24 @@
  1
+--TEST--
  2
+Bug #62915: incomplete cloning of IntlTimeZone objects
  3
+--SKIPIF--
  4
+<?php
  5
+if (!extension_loaded('intl'))
  6
+	    die('skip intl extension not enabled');
  7
+--FILE--
  8
+<?php
  9
+
  10
+class foo extends IntlTimeZone {
  11
+		public $foo = 'test';
  12
+			
  13
+				public function __construct() { }
  14
+}
  15
+
  16
+$x = new foo;
  17
+
  18
+try {
  19
+		$z = clone $x;
  20
+} catch (Exception $e) {
  21
+		var_dump($e->getMessage());
  22
+}
  23
+--EXPECT--
  24
+string(39) "Cannot clone unconstructed IntlTimeZone"
2  ext/intl/timezone/timezone_class.cpp
@@ -225,7 +225,7 @@ static zend_object_value TimeZone_clone_obj(zval *object TSRMLS_DC)
225 225
 	to_orig = (TimeZone_object*)zend_object_store_get_object(object TSRMLS_CC);
226 226
 	intl_error_reset(TIMEZONE_ERROR_P(to_orig) TSRMLS_CC);
227 227
 
228  
-	ret_val = TimeZone_ce_ptr->create_object(TimeZone_ce_ptr TSRMLS_CC);
  228
+	ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
229 229
 	to_new  = (TimeZone_object*)zend_object_store_get_object_by_handle(
230 230
 		ret_val.handle TSRMLS_CC);
231 231
 

0 notes on commit dacd11e

Please sign in to comment.
Something went wrong with that request. Please try again.