summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2014-06-28 20:52:41 +0800
committerXinchen Hui <laruence@php.net>2014-06-28 20:52:41 +0800
commitb53bc5c7623db88ba3a2f58c397c06e36e9cad5d (patch)
tree9b70e2000dd8644536cc5dfbac6f165c50c8a15c
parente4e9e80067076074e3e6fd9fd2603ec7698c0d33 (diff)
downloadphp-git-b53bc5c7623db88ba3a2f58c397c06e36e9cad5d.tar.gz
Fixed segfaults
-rw-r--r--ext/intl/calendar/calendar_methods.cpp2
-rw-r--r--ext/intl/intl_data.h2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c7
3 files changed, 7 insertions, 4 deletions
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index 54fe15a8b7..05051d07a4 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -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) {
diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h
index 4b603c8d29..5c65b9c6ea 100644
--- a/ext/intl/intl_data.h
+++ b/ext/intl/intl_data.h
@@ -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) \
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 0def78ea9e..99e578423b 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -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();
+ }
}
/* }}} */