@@ -360,6 +360,7 @@ static int date_interval_compare_objects(zval *o1, zval *o2);
360
360
static zval * date_interval_read_property (zend_object * object , zend_string * member , int type , void * * cache_slot , zval * rv );
361
361
static zval * date_interval_write_property (zend_object * object , zend_string * member , zval * value , void * * cache_slot );
362
362
static zval * date_interval_get_property_ptr_ptr (zend_object * object , zend_string * member , int type , void * * cache_slot );
363
+ static int date_period_has_property (zend_object * object , zend_string * name , int type , void * * cache_slot );
363
364
static zval * date_period_read_property (zend_object * object , zend_string * name , int type , void * * cache_slot , zval * rv );
364
365
static zval * date_period_write_property (zend_object * object , zend_string * name , zval * value , void * * cache_slot );
365
366
static zval * date_period_get_property_ptr_ptr (zend_object * object , zend_string * name , int type , void * * cache_slot );
@@ -1796,6 +1797,7 @@ static void date_register_classes(void) /* {{{ */
1796
1797
date_object_handlers_period .clone_obj = date_object_clone_period ;
1797
1798
date_object_handlers_period .get_gc = date_object_get_gc_period ;
1798
1799
date_object_handlers_period .get_property_ptr_ptr = date_period_get_property_ptr_ptr ;
1800
+ date_object_handlers_period .has_property = date_period_has_property ;
1799
1801
date_object_handlers_period .read_property = date_period_read_property ;
1800
1802
date_object_handlers_period .write_property = date_period_write_property ;
1801
1803
date_object_handlers_period .get_properties_for = date_period_get_properties_for ;
@@ -5926,6 +5928,44 @@ PHP_METHOD(DatePeriod, __wakeup)
5926
5928
}
5927
5929
/* }}} */
5928
5930
5931
+ static int date_period_has_property (zend_object * object , zend_string * name , int type , void * * cache_slot )
5932
+ {
5933
+ zval rv ;
5934
+ zval * prop ;
5935
+
5936
+ if (!date_period_is_internal_property (name )) {
5937
+ return zend_std_has_property (object , name , type , cache_slot );
5938
+ }
5939
+
5940
+ php_period_obj * period_obj = php_period_obj_from_obj (object );
5941
+ if (!period_obj -> initialized ) {
5942
+ switch (type ) {
5943
+ case ZEND_PROPERTY_ISSET : /* Intentional fallthrough */
5944
+ case ZEND_PROPERTY_NOT_EMPTY :
5945
+ return 0 ;
5946
+ case ZEND_PROPERTY_EXISTS :
5947
+ return 1 ;
5948
+ default :
5949
+ ZEND_UNREACHABLE ();
5950
+ break ;
5951
+ }
5952
+ }
5953
+
5954
+ if (type == ZEND_PROPERTY_EXISTS ) {
5955
+ return 1 ;
5956
+ }
5957
+
5958
+ prop = date_period_read_property (object , name , BP_VAR_IS , cache_slot , & rv );
5959
+ ZEND_ASSERT (prop != & EG (uninitialized_zval ));
5960
+
5961
+ if (type == ZEND_PROPERTY_NOT_EMPTY ) {
5962
+ return zend_is_true (prop );
5963
+ }
5964
+
5965
+ ZEND_ASSERT (type == ZEND_PROPERTY_ISSET );
5966
+ return (Z_TYPE_P (prop ) != IS_NULL );
5967
+ }
5968
+
5929
5969
/* {{{ date_period_read_property */
5930
5970
static zval * date_period_read_property (zend_object * object , zend_string * name , int type , void * * cache_slot , zval * rv )
5931
5971
{
0 commit comments