Totally Zenned
- Join Date:
- Dec 2007
- Location:
- Payson, AZ
- Posts:
- 1,075
- Plugin Contributions:
- 7
Type conversion, numeric to string and back
I've upgraded my site to ZC155e so that I could turn on PHP7.1 This is ONLY with PHP7.1 and above, not with less.
Doing so I had to fix my blog so it worked with PHP7.1 and I ran into some issues with different mods. Most of the issues was with type conversion, numeric to string and back.
mktime coursed system crash..
ADMIN/user_tracking.php User Tracking mod
Not sure why the -1 was coursing database issues and posting an error that stated mktime was looking for 6 numbers not 7! Anyway, unless daylight saving is an issue, I normally leave it out or forget to add it.
line 225
$_POST['time'] = mktime (0,0,0, $start_date_month_val,$start_date_day_val,$start_date_year_val,-1);
modified:
$_POST['time'] = mktime (0,0,0, (int)$start_date_month_val,(int)$start_date_day_val,(int)$start_date_year_val);
Auction mod different locations and may or may not be part of yours...
add INT in front of substr or add (int) in front of each variable in the mktime string.
$hour1 = (int)substr($bid_expire_time,0,-6);
$hour2 = (int)substr($bid_expire_time,3,-3);
$hour3 = (int)substr($bid_expire_time,-2,2);
$date1 = (int)substr($bid_expire_date,5,2);
$date2 = (int)substr($bid_expire_date,8,2);
$date3 = (int)substr($bid_expire_date,0,4);
$timestamp1 = mktime($hour1,$hour2,$hour3,$date1,$date2,$date3);
include/classes/categories_ul_generator.php used in many of the fine responsive templates for the mega menu and the default responsive supplied with ZC155e sets off warnings so it's not crashing, just filling up the log folder.
existing line see red area
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. $level+1 . '"' : '' );
fix by type conversion. $level is used as a numeric in other spots so we need to type convert to a string only in this one line.
$level = (int)$level + 1;
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. (string)$level . '"' : '' );
include/functions/functions_general.php Question?
shouldn't line 255 have a int in front as line 237 above does?
$year = substr($raw_date, 0, 4);
$year = (int)substr($raw_date, 0, 4);
This is just a heads up, I'm not in need of solving anything that I can't get with Google... just having fun with type conversions.. :huh:
Dave
Always forward thinking... Lost my mind!