Re: com php-src: Revert "Fixed bug #62852 (Unserialize invalid DateTime causes crash)": ext/date/php_date.c ext/date/tests/bug62852.phpt

From: Date: Sat, 15 Sep 2012 03:35:45 +0000
Subject: Re: com php-src: Revert "Fixed bug #62852 (Unserialize invalid DateTime causes crash)": ext/date/php_date.c ext/date/tests/bug62852.phpt
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-70171@lists.php.net to get a copy of this message
Reeze: as the new comment: http://news.php.net/php.bugs/173451 I revert your fix for now, and leave the test script XFAIL will try to fix this in another way. thanks On Sat, Sep 15, 2012 at 11:26 AM, Xinchen Hui <laruence@php.net> wrote: > Commit: e766f85405cd936a07a30a045f419199b6c02ed7 > Author: Xinchen Hui <laruence@php.net> Sat, 15 Sep 2012 11:26:21 +0800 > Parents: 30981836fa84323d49b2c90bbd805348d58021e4 > Branches: PHP-5.3 > > Link: > http://git.php.net/?p=php-src.git;a=commitdiff;h=e766f85405cd936a07a30a045f419199b6c02ed7 > > Log: > Revert "Fixed bug #62852 (Unserialize invalid DateTime causes crash)" > > see: http://news.php.net/php.bugs/173451 > > This reverts commit 46a3f257724df7b85cc8c3e6374c36ed9ee783b4. > > Bugs: > https://bugs.php.net/62852 > > Changed paths: > M ext/date/php_date.c > D ext/date/tests/bug62852.phpt > > > Diff: > diff --git a/ext/date/php_date.c b/ext/date/php_date.c > index d9e6a28..e8a4570 100644 > --- a/ext/date/php_date.c > +++ b/ext/date/php_date.c > @@ -2544,9 +2544,6 @@ static int php_date_initialize_from_hash(zval **return_value, > php_date_obj **dat > if (zend_hash_find(myht, "timezone_type", 14, (void**) > &z_timezone_type) == SUCCESS) { > convert_to_long(*z_timezone_type); > if (zend_hash_find(myht, "timezone", 9, (void**) > &z_timezone) == SUCCESS) { > - zend_error_handling error_handling; > - > - zend_replace_error_handling(EH_THROW, NULL, &error_handling > TSRMLS_CC); > convert_to_string(*z_timezone); > > switch (Z_LVAL_PP(z_timezone_type)) { > @@ -2554,9 +2551,9 @@ static int php_date_initialize_from_hash(zval **return_value, > php_date_obj **dat > case TIMELIB_ZONETYPE_ABBR: { > char *tmp = emalloc(Z_STRLEN_PP(z_date) + > Z_STRLEN_PP(z_timezone) + 2); > snprintf(tmp, Z_STRLEN_PP(z_date) + > Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone)); > - php_date_initialize(*dateobj, tmp, > Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 TSRMLS_CC); > + php_date_initialize(*dateobj, tmp, > Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); > efree(tmp); > - break; > + return 1; > } > > case TIMELIB_ZONETYPE_ID: > @@ -2570,15 +2567,10 @@ static int php_date_initialize_from_hash(zval **return_value, > php_date_obj **dat > tzobj->tzi.tz = tzi; > tzobj->initialized = 1; > > - php_date_initialize(*dateobj, > Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC); > + php_date_initialize(*dateobj, > Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC); > zval_ptr_dtor(&tmp_obj); > - break; > - default: > - zend_restore_error_handling(&error_handling > TSRMLS_CC); > - return 0; > + return 1; > } > - zend_restore_error_handling(&error_handling TSRMLS_CC); > - return 1; > } > } > } > diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt > deleted file mode 100644 > index 6426a80..0000000 > --- a/ext/date/tests/bug62852.phpt > +++ /dev/null > @@ -1,15 +0,0 @@ > ---TEST-- > -Bug #62852 (Unserialize invalid DateTime causes crash) > ---INI-- > -date.timezone=GMT > ---FILE-- > -<?php > -try { > - $datetime = > unserialize('O:8:"DateTime":3:{s:4:"date";s:20:"10007-06-07 > 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}'); > - var_dump($datetime); > -} catch (Exception $e) { > - var_dump($e->getMessage()); > -} > -?> > ---EXPECTF-- > -string(%d) "DateTime::__wakeup(): Failed to parse time string (%s) at position 12 (0): > Double time specification" > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Laruence Xinchen Hui http://www.laruence.com/

« previous php.cvs (#70171) next »