Loading...
 
Skip to main content

Calendar item start/end hour selection is broken in Tikiwiki 2.0 using PHP 4.3.2 or previous - Patch

Status
Pending
Subject
Calendar item start/end hour selection is broken in Tikiwiki 2.0 using PHP 4.3.2 or previous - Patch
Version
2.x
Category
  • Patch
Feature
Calendar
Submitted by
sacra
Lastmod by
sacra
Rating
(0)
Description

On TikiWiki 2.0, when adding or editing events in a <span class= "highlight_word_0">calendar</span>, if you're using PHP 4.3.2 or previous, you will only be allowed to choose 0, 1 or 2 as the <span class= "highlight_word_1">start</span>/<span class= "highlight_word_2">end</span> hour, even if the <span class= "highlight_word_0">calendar</span> is configured to offer 0-23 or something along those lines.

This is because of the following line in the file $TW_HOME/lib/smarty_tiki/function.html_select_time.php:

Image
Copy to clipboard
$hours = $use_24_hours ? range($hour_min, $hour_max) : range(1, 12);


The range function, as explained here (see ChangeLog), in PHP versions previous to 4.3.2 inclusive, treats numeric strings as strings and not integers which <span class= "highlight_word_2">end</span>s up meaning that "23" is seen as "2", hence producing the problem.

Files
  1. Function.html Select Time
Solution

For example, replace the line by:

Image
Copy to clipboard
$hours = $use_24_hours ? range((int)$hour_min, (int)$hour_max) : range(1, 12);
Importance
3
Priority
15
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
1993
Created
Thursday 28 August, 2008 13:13:32 UTC
by Unknown
LastModif
Saturday 06 July, 2024 10:21:44 UTC


Show PHP error messages