summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2014-06-18 09:44:06 +0200
committerOndřej Surý <ondrej@sury.org>2014-06-18 09:51:45 +0200
commita0154edff0df5e3ab184b9f1e066bcae70b4e316 (patch)
tree5c3129d52a723b33204f2d7700ae3c8f65451c41 /debian/patches
parent84b09854bd5e00d5da798ba1288c6b3c38584dc5 (diff)
downloadphp-a0154edff0df5e3ab184b9f1e066bcae70b4e316.tar.gz
Fix regression introduce in fix for bug #67118
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/php-reg67118.patch112
-rw-r--r--debian/patches/series1
2 files changed, 113 insertions, 0 deletions
diff --git a/debian/patches/php-reg67118.patch b/debian/patches/php-reg67118.patch
new file mode 100644
index 000000000..23856e725
--- /dev/null
+++ b/debian/patches/php-reg67118.patch
@@ -0,0 +1,112 @@
+From 1fe9f1e4f572d7b4d5a3872f41ea61e71fb563bf Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@php.net>
+Date: Thu, 5 Jun 2014 13:39:46 +0200
+Subject: [PATCH] Fix regression introduce in fix for bug #67118
+
+The fix was correct but break some code (at least in Horde)
+This is a temporary workaround to fix regressioni in 5.4, 5.5 and 5.6
+
+This make php_date_initialize more consistent
+- on success return 1 + time initiliazed
+- on failure return 0 + time = zero
+ which is check by DATE_CHECK_INITIALIZED by later method call
+
+Will restore consistency with other date classes in master.
+---
+ ext/date/php_date.c | 6 +++---
+ ext/date/tests/bug67118.phpt | 18 +++++++++---------
+ 2 files changed, 12 insertions(+), 12 deletions(-)
+
+--- php5.orig/ext/date/php_date.c
++++ php5/ext/date/php_date.c
+@@ -2599,6 +2599,8 @@ PHPAPI int php_date_initialize(php_date_
+ err->error_messages[0].position, err->error_messages[0].character, err->error_messages[0].message);
+ }
+ if (err && err->error_count) {
++ timelib_time_dtor(dateobj->time);
++ dateobj->time = 0;
+ return 0;
+ }
+
+@@ -2746,9 +2748,7 @@ PHP_METHOD(DateTime, __construct)
+
+ zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) {
+- if (!php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC)) {
+- ZVAL_NULL(getThis());
+- }
++ php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC);
+ }
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
+ }
+--- php5.orig/ext/date/tests/bug67118.phpt
++++ php5/ext/date/tests/bug67118.phpt
+@@ -1,5 +1,5 @@
+ --TEST--
+-Bug #67118 php-cgi crashes regularly on IIS 7
++Bug #67118 crashes in DateTime when this used after failed __construct
+ --INI--
+ date.timezone=Europe/Berlin
+ --FILE--
+@@ -12,16 +12,16 @@ class mydt extends datetime
+ $tz = new DateTimeZone($tz);
+ }
+
+- @parent::__construct($time, $tz);
++ try {
++ @parent::__construct($time, $tz);
++ } catch (Exception $e) {
++ echo "Bad date" . $this->format("Y") . "\n";
++ }
+ }
+
+ };
+
+ new mydt("Funktionsansvarig rådgivning och juridik", "UTC");
+ --EXPECTF--
+-Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Funktionsansvarig rådgivning och juridik) at position 0 (F): The timezone could not be found in the database' in %sbug67118.php:%d
+-Stack trace:
+-#0 %sbug67118.php(%d): DateTime->__construct('Funktionsansvar...', Object(DateTimeZone))
+-#1 %sbug67118.php(%d): mydt->__construct('Funktionsansvar...', 'UTC')
+-#2 {main}
+- thrown in %sbug67118.php on line %d
++Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug67118.php on line %d
++Bad date
+--- /dev/null
++++ php5/ext/date/tests/bug67118_2.phpt
+@@ -0,0 +1,35 @@
++--TEST--
++Regression introduce in fix for Bug #67118
++--INI--
++date.timezone=Europe/Paris
++--FILE--
++<?php
++class Foo extends DateTime {
++ public function __construct($time = null) {
++ $tz = new DateTimeZone('UTC');
++ try {
++ echo "First try\n";
++ parent::__construct($time, $tz);
++ return;
++ } catch (Exception $e) {
++ echo "Second try\n";
++ parent::__construct($time.'C', $tz);
++ }
++ }
++}
++$date = '12 Sep 2007 15:49:12 UT';
++var_dump(new Foo($date));
++?>
++Done
++--EXPECTF--
++First try
++Second try
++object(Foo)#1 (3) {
++ ["date"]=>
++ string(%d) "2007-09-12 15:49:%s"
++ ["timezone_type"]=>
++ int(3)
++ ["timezone"]=>
++ string(3) "UTC"
++}
++Done
diff --git a/debian/patches/series b/debian/patches/series
index e4776cf07..91f714c99 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -39,3 +39,4 @@ use_system_timezone.patch
zlib-largefile-function-renaming.patch
CVE-2014-4049.patch
php-reg67072.patch
+php-reg67118.patch