Summary | [kronolith] PHP ERROR: Undefined offset: 1 [pid 8052 on line 169 of "/usr/share/php/Horde/Timezone/Zone.php"] |
Queue | Horde Framework Packages |
Queue Version | Git master |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | jan (at) horde (dot) org |
Requester | skhorde (at) smail (dot) inf (dot) fh-bonn-rhein-sieg (dot) de |
Created | 08/20/2014 (4009 days ago) |
Due | |
Updated | 08/20/2014 (4009 days ago) |
Assigned | |
Resolved | 08/20/2014 (4009 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
Assigned to Jan Schneider
State ⇒ Resolved
Author: Jan Schneider <jan@horde.org>
Date: Wed Aug 20 18:28:50 2014 +0200
Strip trailing whitespace before comments too.
framework/Timezone/lib/Horde/Timezone.php | 2 +-
framework/Timezone/package.xml | 12 ++++--
framework/Timezone/test/Horde/Timezone/IcalendarTest.php | 21 -----------
framework/Timezone/test/Horde/Timezone/Mock.php | 27
++++++++++++++
framework/Timezone/test/Horde/Timezone/ParseTest.php | 16 ++++++++
5 files changed, 52 insertions(+), 26 deletions(-)
create mode 100644 framework/Timezone/test/Horde/Timezone/Mock.php
create mode 100644 framework/Timezone/test/Horde/Timezone/ParseTest.php
http://github.com/horde/horde/commit/241ac91ad1436797cb80344648d173aee5fb062a
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ [kronolith] PHP ERROR: Undefined offset: 1 [pid 8052 on line 169 of "/usr/share/php/Horde/Timezone/Zone.php"]
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
$this->_info[$line] = array(
0 => '-0:36:32',
1 => '-',
2 => 'LMT',
3 => '1912',
4 => 'Jan',
5 => '1',
6 => '',
)
In line 140 of Horde/Timezone/Zone.php $date[3] == '', therefore line
141 matches nothing.
$time = isset($date[3]) && $date[3] != '-' ? $date[3] : 0;
Dunno if the data in the array makes any sense at all, but how about
to change:
$time = isset($date[3]) && $date[3] != '-' ? $date[3] : 0;
preg_match('/(\d+)(?::(\d+))?(?::(\d+))?(w|s|u)?/', $time, $match);
if (!isset($match[2])) {
into
! $time = isset($date[3])? $date[3] : 0;
preg_match('/(\d+)(?::(\d+))?(?::(\d+))?(w|s|u)?/', $time, $match);
+ if (!isset($match[1])) {
+ $match[1] = 0;
+ }
if (!isset($match[2])) {