]> granicus.if.org Git - php/commitdiff
Fixed segfaults
authorXinchen Hui <laruence@php.net>
Sat, 28 Jun 2014 12:52:41 +0000 (20:52 +0800)
committerXinchen Hui <laruence@php.net>
Sat, 28 Jun 2014 12:52:41 +0000 (20:52 +0800)
ext/intl/calendar/calendar_methods.cpp
ext/intl/intl_data.h
ext/intl/resourcebundle/resourcebundle_class.c

index 54fe15a8b715f52bf92e52fc3a5ec4d91d4a043c..05051d07a479d8077b34dd6935966fe1d7a9665b 100644 (file)
@@ -1220,7 +1220,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
        calendar_object_create(return_value, cal TSRMLS_CC);
 
 error:
-       if (zv_datetime != zv_arg) {
+       if (zv_datetime && zv_datetime != zv_arg) {
                zval_ptr_dtor(zv_datetime);
        }
        if (zv_timestamp) {
index 4b603c8d292b9d8556783d379de99fa62bdf5890..5c65b9c6ea213c6dea6269d2af0b12413976223d 100644 (file)
@@ -28,8 +28,8 @@
    for this to work! 
 */
 typedef struct _intl_data {
-       zend_object             zo;
        intl_error              error;
+       zend_object             zo;
 } intl_object;
 
 #define INTL_METHOD_INIT_VARS(oclass, obj)             \
index 0def78ea9e33f882379a31e9e9061d74e0ac3533..99e578423b530db5db95f6605fcced599d1d65a7 100644 (file)
@@ -92,8 +92,8 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
        {
                intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                        "resourcebundle_ctor: unable to parse input parameters", 0 TSRMLS_CC );
-               zval_dtor( return_value );
-               RETURN_NULL();
+               Z_OBJ_P(return_value) = NULL;
+               return;
        }
 
        INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
@@ -152,6 +152,9 @@ PHP_FUNCTION( resourcebundle_create )
 {
        object_init_ex( return_value, ResourceBundle_ce_ptr );
        resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+       if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) {
+               RETURN_NULL();
+       }
 }
 /* }}} */