summaryrefslogtreecommitdiff
path: root/ext/intl/dateformat/dateformat_class.c
diff options
context:
space:
mode:
authorULF WENDEL <uw@php.net>2012-10-22 13:37:37 +0200
committerULF WENDEL <uw@php.net>2012-10-22 13:37:37 +0200
commitdfeb91acc7d44cc5035db34a31310dc3075df11f (patch)
treee6e1b6c6898fc10eb602a9f5317371180d208b5b /ext/intl/dateformat/dateformat_class.c
parent645f84e41bbda22c7a19326cd1a7df7994678976 (diff)
parentdbb72de6c75796803ed6ed103763a12eebc9e78e (diff)
downloadphp-git-dfeb91acc7d44cc5035db34a31310dc3075df11f.tar.gz
Merge branch 'PHP-5.3' of git.php.net:php-src into PHP-5.3
* 'PHP-5.3' of git.php.net:php-src: (123 commits) Re-fixed bug #60901 (Improve "tail" syntax for AIX installation) updated NEWS Fixed bug #63284 PCRE upgrade to 8.31 preg indenpent test script for #63055 Update libmagic.patch Add fix & missing fix Fixed bug #63307 (Unused variable in oci8.c) Fixed bug #63265 (Add ORA-00028 to the PHP_OCI_HANDLE_ERROR macro) - Updated to version 2012.7 (2012g) SUpport newer bisons. Merge the fix for #61964 to 5.3, which will fix #63304 indent better fix for #63055 Fixed bug #63055 (Segfault in zend_gc with SF2 testsuite) PHP 5.3.18 NEWS fix NEWS fix compilation failure on 32/64bit linux systems, when libmysql is used with ext/mysql Remove executable permission on inc Remove executable permission on phpt Fixed bug #63236 (Executable permission on various source files) ...
Diffstat (limited to 'ext/intl/dateformat/dateformat_class.c')
-rw-r--r--ext/intl/dateformat/dateformat_class.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c
index eb3f5f4e77..a7227ef03d 100644
--- a/ext/intl/dateformat/dateformat_class.c
+++ b/ext/intl/dateformat/dateformat_class.c
@@ -23,6 +23,8 @@
#include "dateformat.h"
#include "dateformat_attr.h"
+#include <zend_exceptions.h>
+
zend_class_entry *IntlDateFormatter_ce_ptr = NULL;
static zend_object_handlers IntlDateFormatter_handlers;
@@ -87,18 +89,23 @@ zend_object_value IntlDateFormatter_object_clone(zval *object TSRMLS_DC)
zend_object_handle handle = Z_OBJ_HANDLE_P(object);
IntlDateFormatter_object *dfo, *new_dfo;
- DATE_FORMAT_METHOD_FETCH_OBJECT;
- new_obj_val = IntlDateFormatter_ce_ptr->create_object(IntlDateFormatter_ce_ptr TSRMLS_CC);
+ DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
+
+ new_obj_val = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
new_dfo = (IntlDateFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC);
/* clone standard parts */
zend_objects_clone_members(&new_dfo->zo, new_obj_val, &dfo->zo, handle TSRMLS_CC);
/* clone formatter object */
- DATE_FORMAT_OBJECT(new_dfo) = udat_clone(DATE_FORMAT_OBJECT(dfo), &INTL_DATA_ERROR_CODE(new_dfo));
- if(U_FAILURE(INTL_DATA_ERROR_CODE(new_dfo))) {
- /* set up error in case error handler is interested */
- intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_dfo), "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC );
- IntlDateFormatter_object_dtor(new_dfo, new_obj_val.handle TSRMLS_CC); /* free new object */
- zend_error(E_ERROR, "Failed to clone IntlDateFormatter object");
+ if (dfo->datef_data.udatf != NULL) {
+ DATE_FORMAT_OBJECT(new_dfo) = udat_clone(DATE_FORMAT_OBJECT(dfo), &INTL_DATA_ERROR_CODE(dfo));
+ if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) {
+ /* set up error in case error handler is interested */
+ intl_errors_set(INTL_DATA_ERROR_P(dfo), INTL_DATA_ERROR_CODE(dfo),
+ "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC );
+ zend_throw_exception(NULL, "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC);
+ }
+ } else {
+ zend_throw_exception(NULL, "Cannot clone unconstructed IntlDateFormatter", 0 TSRMLS_CC);
}
return new_obj_val;
}