diff options
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r-- | ext/date/php_date.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 2f52353ce2..fbb142b66d 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -28,6 +28,7 @@ #include "ext/standard/php_math.h" #include "php_date.h" #include "zend_interfaces.h" +#include "zend_exceptions.h" #include "lib/timelib.h" #include <time.h> @@ -3699,7 +3700,8 @@ PHP_METHOD(DateTimeZone, __set_state) php_date_instantiate(date_ce_timezone, return_value); tzobj = Z_PHPTIMEZONE_P(return_value); if(php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht) != SUCCESS) { - php_error_docref(NULL, E_ERROR, "Timezone initialization failed"); + zend_throw_error(zend_ce_error, "Timezone initialization failed"); + RETURN_FALSE; } } /* }}} */ @@ -3717,7 +3719,8 @@ PHP_METHOD(DateTimeZone, __wakeup) myht = Z_OBJPROP_P(object); if(php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht) != SUCCESS) { - php_error_docref(NULL, E_ERROR, "Timezone initialization failed"); + zend_throw_error(zend_ce_error, "Timezone initialization failed"); + RETURN_FALSE; } } /* }}} */ @@ -5015,7 +5018,8 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi { zval *zv; if (type != BP_VAR_IS && type != BP_VAR_R) { - php_error_docref(NULL, E_ERROR, "Retrieval of DatePeriod properties for modification is unsupported"); + zend_throw_error(zend_ce_error, "Retrieval of DatePeriod properties for modification is unsupported"); + return NULL; } Z_OBJPROP_P(object); /* build properties hash table */ @@ -5033,7 +5037,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi /* {{{ date_period_write_property */ static void date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot) { - php_error_docref(NULL, E_ERROR, "Writing to DatePeriod properties is unsupported"); + zend_throw_error(zend_ce_error, "Writing to DatePeriod properties is unsupported"); } /* }}} */ |