php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #53437
Patch date_patch_var4.patch revision 2013-03-14 15:21 UTC by ab@php.net
Patch date_patch_var3.patch revision 2013-03-13 08:53 UTC by ab@php.net
Patch glopes_date_5.3.patch revision 2013-03-06 18:50 UTC by ab@php.net
revision 2013-03-05 11:19 UTC by ab@php.net
Patch glopes_date_5.4.patch revision 2013-03-05 11:20 UTC by ab@php.net

Patch glopes_date_5.3.patch for Date/time related Bug #53437

Patch version 2013-03-06 18:50 UTC

Return to Bug #53437 | Download this patch
This patch is obsolete

Obsoleted by patches:

This patch renders other patches obsolete

Obsolete patches:

Patch Revisions: 2013-03-06 18:50 UTC | 2013-03-05 11:19 UTC

Developer: ab@php.net



  diff --git a/ext/date/php_date.c b/ext/date/php_date.c
 index 2e616b1..e9aa7b0 100644
 index 2e616b1..e9d9f17 100644
  --- a/ext/date/php_date.c
  +++ b/ext/date/php_date.c
  @@ -23,6 +23,7 @@
   #include "php_main.h"


  +static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC);
   
   zval *date_interval_read_property(zval *object, zval *member, int type TSRMLS_DC);
   void date_interval_write_property(zval *object, zval *member, zval *value TSRMLS_DC);
 +static zval *date_period_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC);
 +static zval **date_period_get_property_ptr_ptr(zval *object, zval *member, const zend_literal *key TSRMLS_DC);
 +static void date_period_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC);
 +static zval *date_period_read_property(zval *object, zval *member, int type TSRMLS_DC);
 +static zval **date_period_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC);
 +static void date_period_write_property(zval *object, zval *member, zval *value TSRMLS_DC);
  +
  +static int php_date_interval_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
  +static int php_date_interval_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
   


   				break;
   		}
  -		zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL);
  +		zend_hash_update(out_container, "timezone", 9, &zv, sizeof(zval), NULL);
 +	}
  	}
  +}
  +
  +static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
  +{
  +	HashTable *props;
  +	php_date_obj     *dateobj;
 +
  
  +
  +	dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
  +
  +	props = zend_std_get_properties(object TSRMLS_CC);
  +
  +	if (!dateobj->time || GC_G(gc_active)) {
  +		return props;
  	}
  
 +	}
 +
  +	date_object_to_serializable_elements(dateobj->time, props);
  +	
   	return props;
   }


  +	php_date_initialize_from_hash(dateobj, myht TSRMLS_CC);
   }
   /* }}} */
   
 @@ -3732,6 +3827,187 @@ PHP_FUNCTION(date_interval_create_from_date_string)
 @@ -3691,20 +3786,6 @@ PHP_METHOD(DateInterval, __set_state)
  }
  /* }}} */
  
 -/* {{{ proto DateInterval::__wakeup()
 -*/
 -PHP_METHOD(DateInterval, __wakeup)
 -{
 -	zval             *object = getThis();
 -	php_interval_obj *intobj;
 -	HashTable        *myht;
 -
 -	intobj = (php_interval_obj *) zend_object_store_get_object(object TSRMLS_CC);
 -
 -	myht = Z_OBJPROP_P(object);
 -
 -	php_date_interval_initialize_from_hash(&return_value, &intobj, myht TSRMLS_CC);
 -}
  /* }}} */
  /* {{{ proto DateInterval date_interval_create_from_date_string(string time)
     Uses the normal date parsers and sets up a DateInterval from the relative parts of the parsed string
 @@ -3732,6 +3813,187 @@ PHP_FUNCTION(date_interval_create_from_date_string)
   }
   /* }}} */
   
  +#define PHP_DATE_INTERVAL_UNSER_RAW_SIZE 92 /* 6 * 8 + 4 * 4 + 8 + (4 + 8) + 2 * 4; not null-terminated */


  +
   /* {{{ date_interval_format -  */
   static char *date_interval_format(char *format, int format_len, timelib_rel_time *t)
   {
 @@ -3838,6 +4114,43 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
 @@ -3838,6 +4100,43 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
   	return retval;
   }
   
  +/* {{{ date_period_read_property */
 +static zval *date_period_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC)
 +static zval *date_period_read_property(zval *object, zval *member, int type TSRMLS_DC)
  +{
  +	zval *zv;
  +	if (type != BP_VAR_IS && type != BP_VAR_R) {
  +		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Retrieval of DatePeriod properties for modification is unsupported");
  +	}
  +
  +	Z_OBJPROP_P(object); /* build properties hash table */
  +
 +	zv = std_object_handlers.read_property(object, member, type, key TSRMLS_CC);
 +	zv = std_object_handlers.read_property(object, member, type TSRMLS_CC);
  +	if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJ_HANDLER_P(zv, clone_obj)) {
  +		/* defensive copy */
  +		zend_object_value zov = Z_OBJ_HANDLER_P(zv, clone_obj)(zv TSRMLS_CC);
  +		MAKE_STD_ZVAL(zv);


  +}
  +/* }}} */
  +
  +/* {{{ date_period_get_property_ptr_ptr */
 +static zval **date_period_get_property_ptr_ptr(zval *object, zval *member, const zend_literal *key TSRMLS_DC)
 +static zval **date_period_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC)
  +{
  +	return NULL; /* force fallback to read_property */
  +}
  +/* }}} */
  +
  +/* {{{ date_period_write_property */
 +static void date_period_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
 +static void date_period_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
  +{
  +	php_error_docref(NULL TSRMLS_CC, E_ERROR, "Writing to DatePeriod properties is unsupported");
  +}
  +/* }}} */
  +
   /* {{{ proto DatePeriod::__construct(DateTime $start, DateInterval $interval, int recurrences|DateTime $end)
      Creates new DatePeriod object.
   */
 @@ -3924,6 +4237,119 @@ PHP_METHOD(DatePeriod, __construct)
 @@ -3924,6 +4223,119 @@ PHP_METHOD(DatePeriod, __construct)
   }
   /* }}} */
   
  +static int php_date_period_initialize_from_hash(php_period_obj *period_obj, HashTable *myht TSRMLS_DC)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 14:02:18 2014 UTC