By Guest on Sunday, 21 May 2017
Replies 7
Likes 0
Views 10.8K
Votes 0
Hi

after switching to PHP 7.1 I am getting this error in the frontend event list:

Warning: A non-numeric value encountered in /home/sites/public_html/components/com_jevents/views/default/helpers/defaultloadedfromtemplate.php on line 1083

Warning: A non-numeric value encountered in /home/sites/public_html/components/com_jevents/views/default/helpers/defaultloadedfromtemplate.php on line 1084

As soon as I switch back to PHP 7.0, the error has gone.


PHP Version : 7.1.4
MySQL Version : 5.5.5-10.1.14-MariaDB
Server Information : Linux web6.n4.stackcp.net 2.6.32-696.1.1.el6.x86_64 #1 SMP Tue Apr 11 17:13:24 UTC 2017 x86_64
Fix jQuery? : Yes
Load JEvents Bootstrap CSS? : Yes
Max Input Vars ? : 2500
Club code set? : No
User Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0
Joomla : 3.7.1
component_com_jevents : 3.4.39
component_com_jce : 2.6.12
module_mod_jevents_cal : 3.4.39
module_mod_jevents_custom : 3.4.39
module_mod_jevents_filter : 3.4.39
module_mod_jevents_latest : 3.4.39
module_mod_jevents_legend : 3.4.39
module_mod_jevents_switchview : 3.4.39
plugin_content_jevents : 3.4.39
plugin_finder_jevents : 3.4.39
plugin_installer_jeventsinstaller : 3.4.39 (not enabled)
plugin_search_eventsearch : 3.4.39
plugin_system_gwejson : 3.4.39


Kind regards
Christof
I had that problem
on line 1059 of defaultloadedfromtemplate you have this statement:
$timedelta = $row->noendtime() ? "" : $row->getUnixEndTime() - $row->getUnixStartTime();

if you replace it with:
$timedelta = $row->noendtime() ? 0 : $row->getUnixEndTime() - $row->getUnixStartTime();

(simply a replacement of "" by 0, as "" is a string and hence not a numeric value)
does that fix your problem?
·
Sunday, 21 May 2017 20:53
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you. In defaultloadedfromtemplate.php on line 1083 we have
$days = intval($timedelta / (60 * 60 * 24));

and on line 1084 we have
$timedelta -= $days * 60 * 60 * 24;

What changes do you suggest there? However, I think this is a Jevents bug that should be resolved in an upcoming version. That's the reason for my report.
·
Monday, 22 May 2017 06:58
·
0 Likes
·
0 Votes
·
0 Comments
·
hi,
the update to line 1059 fixes line 1083 because now if $timedelta is 0 it doesn't cause an error, whereas before it was trying to divide a string by a number. Similarly on line 1084 subtraction works if $timedelta is 0
php7 issues many more warnings and notices than previous versions which is why you are only now seeing the error when you upgrade.
·
Monday, 22 May 2017 12:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Note, JEvents hasn't been tested fully on PHP7.1 yet and we advised PHP 7.0.

Many thanks
Tony
·
Monday, 22 May 2017 14:06
·
0 Likes
·
0 Votes
·
0 Comments
·
heleneross - thanks for your insights we'll change the declaration of $timedelta for the next release of JEvents.
·
Monday, 22 May 2017 16:29
·
0 Likes
·
0 Votes
·
0 Comments
·
PHP 7.0 is completely outdated. I hope the next update of JEvents/RSVP Pro will be soon, and fully PHP 7.2+ compliant.
·
Saturday, 26 January 2019 13:11
·
0 Likes
·
0 Votes
·
0 Comments
·
PHP 7.0 is completely outdated. I hope the next update of JEvents/RSVP Pro will be soon, and fully PHP 7.2+ compliant.

In the meantime, Jevents should be fully PHP 7.3 compliant. I am using Jevents 3.4.48 on several websites based on PHP 7.3

Kind regards
Christof
·
Saturday, 26 January 2019 14:14
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post