Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #19196 > unrolled thread

Re: Scripts getting by in php7 but chokes in php8

Started by"J.O. Aho" <user@example.net>
First post2022-12-03 10:36 +0100
Last post2022-12-03 10:36 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.php

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Scripts getting by in php7 but chokes in php8 "J.O. Aho" <user@example.net> - 2022-12-03 10:36 +0100

#19196 — Re: Scripts getting by in php7 but chokes in php8

From"J.O. Aho" <user@example.net>
Date2022-12-03 10:36 +0100
SubjectRe: Scripts getting by in php7 but chokes in php8
Message-ID<jv0jktF77k4U1@mid.individual.net>
On 03/12/2022 03.44, The Doctor wrote:
> Here are a couple of scripts that are working in php7 but choke in php8

Too much code for usergroup posts, give a link to your git repository 
instead, if you don't have one, gitlab and github offers you some space 
for free.

> In the error log we are seeing
> 
> 2022/12/01 08:26:20 [error] 51954#102104: *266090 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined index: sessionid in /path/to/step2.php on line 30PHP message: PHP Warning:  Use of undefined constant charge_total - assumed 'charge_total' (this will throw an Error in a future version of PHP) in /path/to/step2.php on line 33PHP message: PHP Warning:  Use of undefined constant bill_first_name - assumed 'bill_first_name' (this will throw an Error in a future version of PHP) in /path/to/step2.php on line 35PHP message: PHP Warning:  Use of undefined constant bill_last_name - assumed 'bill_last_name' (this will throw an Error in a future version of PHP) in /path/to/step2.php on line 36PHP message: PHP Warning:  Use of undefined constant bill_company_name - assumed 'bill_company_name' (this will throw an Error in a future version of PHP) in /path/to/step2.php on line 37PHP message: PHP Warning:  Use of undefined constant bill_address_one - assumed 'bill_address_one' (this will throw an Error in a future version of PHP) in /path/to/step2.php on line 38PHP message: PHP Warning:  Use of undefined constant bill_city - assumed 'bill_city' (this will throw an Error in a future version of PHP) in /path/to/step2.php on line 39PHP message: PHP Warning:  Use of undefined constant bill_state_or_province - assumed 'bill_state_or_province' (this will throw an Error in a future version of PHP) in /path/to/step2.php on line 40PHP message: PHP Warning:  Use of undefined constant bill_postal_code - assumed 'bill_postal_code' (this will throw an Error in a future version of PHP) in /path/to/step2.php on line 41PHP message: PHP Warning:  Use of undefined constant bill_phone - assumed 'bill_phone' (this will throw an Error in a future version of PHP) in /usr/local/www/n

Seems to be the classic issue of not declaring variables/constants ahead 
of use.
Please try to follow C/C++ coding standard.


>        2022/12/02 10:44:29 [error] 51954#102104: *557026 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "sessionid" in /path/to/step2.php on line 30PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "charge_total" in /path/to/step2.php:33

try/catch is a good way of handling issues that arises when you can't 
check if value exists or not before use.


> 			  What pointers for fixes?

Always be sure the value exists before you use it.


-- 

  //Aho

[toc] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web