]> granicus.if.org Git - php/commitdiff
- Fixed bug #53612 (Segmentation fault when using several cloned intl
authorGustavo André dos Santos Lopes <cataphract@php.net>
Mon, 27 Dec 2010 01:10:08 +0000 (01:10 +0000)
committerGustavo André dos Santos Lopes <cataphract@php.net>
Mon, 27 Dec 2010 01:10:08 +0000 (01:10 +0000)
  objects).

NEWS
ext/intl/collator/collator_class.c
ext/intl/dateformat/dateformat_class.c
ext/intl/formatter/formatter_class.c
ext/intl/msgformat/msgformat_class.c
ext/intl/resourcebundle/resourcebundle_class.c

diff --git a/NEWS b/NEWS
index 3492a8f166b11560a7ddacd0627933571553c124..c9dc8ff10f88fb0c137e504026e81f9d6a29872d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,8 @@
 - Intl extension:
   . Fixed bug #53512 (NumberFormatter::setSymbol crash on bogus $attr values).
     (Felipe)
+  . Fixed bug #53612 (Segmentation fault when using cloned several intl
+    objects). (Gustavo)
 
 - MySQL Improved extension:
   . Fixed bug #53503 (mysqli::query returns false after successful LOAD DATA 
index ee16ee03e1bdefbfc49c451260849a566191b5f3..021099c15ee7dba3f3309248d24af7a6042bf66e 100755 (executable)
@@ -29,6 +29,7 @@
 #include <unicode/ucol.h>
 
 zend_class_entry *Collator_ce_ptr = NULL;
+static zend_object_handlers Collator_handlers;
 
 /*
  * Auxiliary functions needed by objects of 'Collator' class
@@ -73,7 +74,7 @@ zend_object_value Collator_object_create(
                (zend_objects_free_object_storage_t)Collator_objects_free,
                NULL TSRMLS_CC );
 
-       retval.handlers = zend_get_std_object_handlers();
+       retval.handlers = &Collator_handlers;
 
        return retval;
 }
@@ -142,6 +143,10 @@ void collator_register_Collator_class( TSRMLS_D )
        ce.create_object = Collator_object_create;
        Collator_ce_ptr = zend_register_internal_class( &ce TSRMLS_CC );
 
+       memcpy(&Collator_handlers, zend_get_std_object_handlers(),
+               sizeof Collator_handlers);
+       Collator_handlers.clone_obj = NULL;
+
        /* Declare 'Collator' class properties. */
        if( !Collator_ce_ptr )
        {
index 7df95816e20252ae01db07ad02494bed4317fc40..ab9ad190cbee96e7c0a12cc6d8c75768d6da8653 100755 (executable)
@@ -24,6 +24,7 @@
 #include "dateformat_attr.h"
 
 zend_class_entry *IntlDateFormatter_ce_ptr = NULL;
+static zend_object_handlers IntlDateFormatter_handlers;
 
 /*
  * Auxiliary functions needed by objects of 'IntlDateFormatter' class
@@ -73,7 +74,7 @@ zend_object_value IntlDateFormatter_object_create(zend_class_entry *ce TSRMLS_DC
                (zend_objects_free_object_storage_t)IntlDateFormatter_object_free,
                NULL TSRMLS_CC );
 
-       retval.handlers = zend_get_std_object_handlers();
+       retval.handlers = &IntlDateFormatter_handlers;
 
        return retval;
 }
@@ -161,6 +162,10 @@ void dateformat_register_IntlDateFormatter_class( TSRMLS_D )
        ce.create_object = IntlDateFormatter_object_create;
        IntlDateFormatter_ce_ptr = zend_register_internal_class( &ce TSRMLS_CC );
 
+       memcpy(&IntlDateFormatter_handlers, zend_get_std_object_handlers(),
+               sizeof IntlDateFormatter_handlers);
+       IntlDateFormatter_handlers.clone_obj = NULL;
+
        /* Declare 'IntlDateFormatter' class properties. */
        if( !IntlDateFormatter_ce_ptr )
        {
index a6f45108ea9e6185ffd4781967760fdf6f378c40..69f3b8871455b033e449a237934451590ed4b4ee 100755 (executable)
@@ -25,6 +25,7 @@
 #include "formatter_attr.h"
 
 zend_class_entry *NumberFormatter_ce_ptr = NULL;
+static zend_object_handlers NumberFormatter_handlers;
 
 /*
  * Auxiliary functions needed by objects of 'NumberFormatter' class
@@ -69,7 +70,7 @@ zend_object_value NumberFormatter_object_create(
                (zend_objects_free_object_storage_t)NumberFormatter_object_free,
                NULL TSRMLS_CC );
 
-       retval.handlers = zend_get_std_object_handlers();
+       retval.handlers = &NumberFormatter_handlers;
 
        return retval;
 }
@@ -171,6 +172,10 @@ void formatter_register_class( TSRMLS_D )
        ce.create_object = NumberFormatter_object_create;
        NumberFormatter_ce_ptr = zend_register_internal_class( &ce TSRMLS_CC );
 
+       memcpy(&NumberFormatter_handlers, zend_get_std_object_handlers(),
+               sizeof NumberFormatter_handlers);
+       NumberFormatter_handlers.clone_obj = NULL;
+
        /* Declare 'NumberFormatter' class properties. */
        if( !NumberFormatter_ce_ptr )
        {
index b710ee708627bf8550117d48e15236f53cbe9a25..efa3a411a34e59d9cf3e1c8f183753bfa8fd296c 100755 (executable)
@@ -25,6 +25,7 @@
 #include "msgformat_attr.h"
 
 zend_class_entry *MessageFormatter_ce_ptr = NULL;
+static zend_object_handlers MessageFormatter_handlers;
 
 /*
  * Auxiliary functions needed by objects of 'MessageFormatter' class
@@ -66,7 +67,7 @@ zend_object_value MessageFormatter_object_create(zend_class_entry *ce TSRMLS_DC)
                (zend_objects_free_object_storage_t)MessageFormatter_object_free,
                NULL TSRMLS_CC );
 
-       retval.handlers = zend_get_std_object_handlers();
+       retval.handlers = &MessageFormatter_handlers;
 
        return retval;
 }
@@ -135,6 +136,10 @@ void msgformat_register_class( TSRMLS_D )
        ce.create_object = MessageFormatter_object_create;
        MessageFormatter_ce_ptr = zend_register_internal_class( &ce TSRMLS_CC );
 
+       memcpy(&MessageFormatter_handlers, zend_get_std_object_handlers(),
+               sizeof MessageFormatter_handlers);
+       MessageFormatter_handlers.clone_obj = NULL;
+
        /* Declare 'MessageFormatter' class properties. */
        if( !MessageFormatter_ce_ptr )
        {
index bebd0e8282f1ddbb288e357edf7855045bffe219..9242b57f2ff92687a120f249c5a40b5775ce1658 100644 (file)
@@ -420,6 +420,7 @@ void resourcebundle_register_class( TSRMLS_D )
        }
 
        ResourceBundle_object_handlers = std_object_handlers;
+       ResourceBundle_object_handlers.clone_obj          = NULL;
        ResourceBundle_object_handlers.read_dimension = resourcebundle_array_get;
        ResourceBundle_object_handlers.count_elements = resourcebundle_array_count;
 }