Reputation: 1
I have WP site (SAFE4YOU) that specializes in insurance that hosting now on "SiteGround" with PHP 7.4 version.
Im trying to migrate that site to "Kinsta" servers but there the earliest PHP version is 8.0 so I have to change the site to that version.
after I migrate the site all looks great except one page, the calculator pricing page : https://safe4you.kinsta.cloud/calculator/main-calculator/
the problem is, after I choose destination and date (first screen), and after I chose ages (second screen) the system needs to trow the results (third screen) and seems its not working.
on error.log:
2022/12/27 08:37:51 [error] 72560#72560: *6310 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-the
functions.php lines: 145 -
$total_days_trip = $_COOKIE['days_2'] ? $_COOKIE['days_2'] : $_COOKIE['days'];
184 -
$results[$company_id]['total_days'] = $post_form['days_2'] ? absint($post_form['days_2']) : absint( $post_form['days'] );
308 -
if($post_form['option_to_person']){ // If in form data have at least 1 extension.
Im trying to change with "Kinsta" support manually the PHP version to 7.4 and they cant keep it because they dont give support for that version. when I changed the version all looks great.
I notice that all the error that came from function.php line have cookies/form data in common.
what I expecting: if you go into that page : https://safe4you.co.il/calculator/main-calculator/ choose destination and date, after that choose passengers ages, and after that all the results need to displayed like on the image.
its really weird. anyone can help?
EDIT thanks to @Muhammad Usman the problem solved on desktop. after I add isset() function all looks great on desktop but seems on mobile (Android & IOS) still have some issues with the third screen (the results). I got on error.log output:
2022/12/28 08:36:00 [error] 129739#129739: *11492 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key "calc_id" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 132" while reading response header from upstream, client: 199.203.113.198, server: safe4you.kinsta.cloud, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php8.0-fpm-safe4you.sock:", host: "safe4you.kinsta.cloud:50951", referrer: "https://safe4you.kinsta.cloud/calculator/main-calculator/"
function.php line 132:
$calc_ID = $_COOKIE["calc_id"];
that cookie created when the window opening so when the user get into the third screen that cookie already created.
the code for creating that cookie:
setcookie('calc_id', $calc_ID, time() + (86400 * 30), "/"); // 86400 = 1 day
anyone know why its happend just on mobile devices?
Upvotes: 0
Views: 829