Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FG: line 453ff: Error message because $minute isset but is not numeric #80

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
2 participants
@FranzGotsis
Copy link

commented Mar 5, 2018

Error because of PHP 7.x
Just a simple change: The code did check whether $hour was set and assumed that $minute is treated alike, but in PHP 7.x $minute is set and empty but not numeric. To make sure you can multiply its value, you have to do a second check and see if it is numeric.

Just a minor change (affects line 449 in the master branch, 453 in Release 1.2.9), but it is still necessary in the master branch.

Way to reproduce the error:
Just create a new task in the month-view of WebCalendar (running on PHP 7.x).

FG: line 453ff: Error message because $minute isset but is not numeric
Error because of PHP 7.x
Just a simple change: The code did check whether $hour was set and assumed that $minute is treated alike, but in PHP 7.x $minute is set and empty but not numeric. To make sure you can multiply its value, you have to do a second check and see if it is numeric.

craigk5n added a commit that referenced this pull request Mar 5, 2018

@craigk5n

This comment has been minimized.

Copy link
Owner

commented Mar 5, 2018

Fixed with different commit:
729e69a

@craigk5n craigk5n closed this Mar 5, 2018

@FranzGotsis

This comment has been minimized.

Copy link
Author

commented Mar 6, 2018

I guess that will do. I am just not sure about the sequence PHP Versions evaluate if statements, so I tend to do things a bit more step by step.
What would be the guarantied answer of is_numeric in case that variable is not set? I experienced a number of surprises with updates in non-documented but otherwise well established behaviors. Downside of my way is that it bloats the code.

Anyway: the commit solves the problem. The proposed solution by bbannon is improving the stability as well (in my opinion) but I would additionally ensure that variables cannot in any way have incorrect values (as done in the commit).

In C/C++ I used to asserts, so that I still get a warning log message, if an illegal state is encountered, even if I can recover in the code. I just do not know how to do that in PHP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.