php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #52808
Patch bug52808.patch revision 2010-09-10 22:18 UTC by sriram dot natarajan at gmail dot com

Patch bug52808.patch for Date/time related Bug #52808

Patch version 2010-09-10 22:18 UTC

Return to Bug #52808 | Download this patch
Patch Revisions:

Developer: sriram.natarajan@gmail.com

Index: ext/date/php_date.c
===================================================================
--- ext/date/php_date.c	(revision 303177)
+++ ext/date/php_date.c	(working copy)
@@ -2240,7 +2240,7 @@
 
 #define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \
 	MAKE_STD_ZVAL(zv); \
-	ZVAL_LONG(zv, intervalobj->diff->f); \
+	ZVAL_LONG(zv, intervalobj->diff ? intervalobj->diff->f : 0); \
 	zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zval), NULL);
 
 	PHP_DATE_INTERVAL_ADD_PROPERTY("y", y);
@@ -2250,7 +2250,7 @@
 	PHP_DATE_INTERVAL_ADD_PROPERTY("i", i);
 	PHP_DATE_INTERVAL_ADD_PROPERTY("s", s);
 	PHP_DATE_INTERVAL_ADD_PROPERTY("invert", invert);
-	if (intervalobj->diff->days != -99999) {
+	if (intervalobj->diff && intervalobj->diff->days != -99999) {
 		PHP_DATE_INTERVAL_ADD_PROPERTY("days", days);
 	} else {
 		MAKE_STD_ZVAL(zv);
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 21:01:55 2014 UTC