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


Groups > comp.lang.php > #19196

Re: Scripts getting by in php7 but chokes in php8

Path csiph.com!news.mixmin.net!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: Scripts getting by in php7 but chokes in php8
Date Sat, 3 Dec 2022 10:36:29 +0100
Lines 51
Message-ID <jv0jktF77k4U1@mid.individual.net> (permalink)
References <tmed5o$2cv3$1@gallifrey.nk.ca>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding base64
X-Trace individual.net OqbHWoQ/f99O4enCNReRnQonhwu8LVRpDkJp/1tm1vCIzMgiqC
Cancel-Lock sha1:SaWVwzOJ/79h2/x3+zfj8RWbOzs=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1
Content-Language en-US-large
In-Reply-To <tmed5o$2cv3$1@gallifrey.nk.ca>
Xref csiph.com comp.lang.php:19196

Show key headers only | View raw


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

Back to comp.lang.php | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web