Skip to content

Commit

Permalink
Fixed issue #80: PHP error for non numeric values when using undefine…
Browse files Browse the repository at this point in the history
…d variables.
  • Loading branch information
craigk5n committed Mar 5, 2018
1 parent d31482f commit 729e69a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions edit_entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,13 @@ function time_selection ( $prefix, $time = '', $trigger = false ) {
$rpt_type = 'none';

// Avoid error for using undefined vars.
if ( ! isset ( $hour ) && $hour != 0 )
$hour = -1;
else
if ( isset ( $hour ) && $hour >= 0 )
if ( ! isset ( $hour ) || !is_numeric($hour))
$hour = 0;
if (!isset ($minute)|| !is_numeric ($minute))
$minute = 0;
else if ( isset ($hour) && is_numeric($hour) && $hour >= 0 ) {
$cal_time = ( $hour * 10000 ) + ( $minute * 100 );
}
$cal_time = ( $hour * 10000 ) + ( isset ( $minute ) ? $minute * 100 : 0 );

if ( empty ( $access ) )
Expand Down Expand Up @@ -762,6 +765,8 @@ function time_selection ( $prefix, $time = '', $trigger = false ) {
<td';

if ( $eType != 'task' ) {
if (! isset($duration) || ! is_numeric($duration))
$duration = 0;
$dur_h = intval ( $duration / 60 );

echo '>&nbsp;</td>
Expand Down

0 comments on commit 729e69a

Please sign in to comment.