Page 1 of 1
PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 16 May 2024, 16:54
by sulpher
AH01071: Got error 'PHP message: PHP Warning: Trying to access array offset on null in /var/www/administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2968;
PHP message: PHP Warning: Trying to access array offset on null in /var/www/administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2969;
PHP message: PHP Warning: Trying to access array offset on null in /var/www/administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2970;
PHP message: PHP Warning: Trying to access array offset on null in /var/www/administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2971;
PHP message: PHP Warning: Trying to access array offset on null in /var/www/administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2972;
PHP message: PHP Warning: Attempt to read property "date" on null in /var/www/administrator/components/com_phocacart/libraries/phocacart/order/status.php on line 131;
PHP message: PHP Warning: Attempt to read property "order_number" on null in /var/www/administrator/components/com_phocacart/libraries/phocacart/order/status.php on line 131;
Re: PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 18 May 2024, 01:20
by Jan
Hi, are you 100% your database table structure is complete?
Do you have following columns in table "phocacart_orders"?
tracking_date_shipped
invoice_date
invoice_due_date
invoice_time_of_supply
required_delivery_time
Jan
Re: PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 18 May 2024, 07:05
by sulpher
Yes, all these columns exist in table.
It was clean installation of PC5 beta51 on J5.1.0.
Re: PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 20 May 2024, 23:30
by Jan
This is hard to say because when the columns are loaded from DB, they should be included in the array/object. Where exactly do you get these errors?
Jan
Re: PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 26 May 2024, 15:22
by sulpher
I can't remember what I did that lead to these issues. I tested payment plugins. WIll take more attention during the next testing.
Btw, is there a situation that some outdated code in the payment plugin leads to these warnings?
Re: PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 28 May 2024, 15:54
by Jan
These are errors inside core libraries, so yes, it is possible that some obsolete plugin can invoke it but the core should somehow protect from this. But on the mentioned lines, the code goes directly from database, so the variables should be loaded there.
Jan
Re: PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 10 Jun 2024, 11:47
by sulpher
Today I logged in to the site, proceeded to My orders page and go to empty checkout page. No payment method was launched and there are entries in error.log:
PHP Warning: Trying to access array offset on null in /var/www//administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2971; PHP message: PHP Warning:
Trying to access array offset on null in /var/www//administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2972; PHP message:
PHP Warning: Trying to access array offset on null in /var/www//administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2973; PHP message: PHP Warning: Trying to access array offset on null in /var/www//administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2974;
PHP message: PHP Warning: Trying to access array offset on null in /var/www//administrator/components/com_phocacart/libraries/phocacart/order/order.php on line 2975;
PHP message: PHP Warning: Attempt to read property "order_number" on null in /var/www//administrator/components/com_phocacart/libraries/phocacart/order/status.php on line 131; PHP message: PHP Warning: Attempt to read property "user_id" on null in /var/www//administrator/components/com_phocacart/libraries/phocacart/order/status.php on line 443'
PC 5.0.0Beta54, PHP 8.3.8, Joomla 5.1.1
Re: PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 11 Jun 2024, 16:12
by Jan
Hi, see the code, there is a database query which asks the columns, e.g. column: tracking_date_shipped
Code: Select all
$query = ' SELECT date, invoice_number_id, invoice_number, invoice_prn, invoice_date, invoice_due_date, invoice_time_of_supply, tracking_date_shipped, required_delivery_time FROM #__phocacart_orders WHERE id = ' . (int)$id . ' ORDER BY id LIMIT 1';
and then you ask the value with:
$d['tracking_date_shipped'] = $orderData['tracking_date_shipped'];
Then it is not possible, that this value will be null, except, e.g. the database column does not exist in your database
Check the table #__phocacart_orders for tracking_date_shipped column
Can you let me know the code of: administrator/components/com_phocacart/libraries/phocacart/order/order.php
between lines: 2964 and 2976?
Jan
Re: PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 13 Jun 2024, 13:20
by sulpher
Jan wrote: ↑11 Jun 2024, 16:12
Hi, see the code, there is a database query which asks the columns, e.g. column: tracking_date_shipped
Code: Select all
$query = ' SELECT date, invoice_number_id, invoice_number, invoice_prn, invoice_date, invoice_due_date, invoice_time_of_supply, tracking_date_shipped, required_delivery_time FROM #__phocacart_orders WHERE id = ' . (int)$id . ' ORDER BY id LIMIT 1';
and then you ask the value with:
$d['tracking_date_shipped'] = $orderData['tracking_date_shipped'];
Then it is not possible, that this value will be null, except, e.g. the database column does not exist in your database
Check the table #__phocacart_orders for tracking_date_shipped column
this column exists:
btw, I just installed several beta versions over existing ones. Is it necessary? No SQL code need to be executed?
As we see, the required column exists, but I just ask for future.
Can you let me know the code of: administrator/components/com_phocacart/libraries/phocacart/order/order.php
between lines: 2964 and 2976?
Jan
Here is code (PC 5.0 beta54 installed) :
Code: Select all
$db->setQuery($query);
$orderData = $db->loadAssoc();
// SEE: administrator/components/com_phocacart/tables/phocacartorder.php
// some date columns cannot have null values, as null values will be transformed to 0000-00-00 00:00:00 in check function
// instead of leaving yet stored data in database (values with null standardly do not change current data in database)
// $d['date'] - defined previously
$d['tracking_date_shipped'] = $orderData['tracking_date_shipped'];
$d['invoice_date'] = $orderData['invoice_date'];
$d['invoice_due_date'] = $orderData['invoice_due_date'];
$d['invoice_time_of_supply']= $orderData['invoice_time_of_supply'];
$d['required_delivery_time']= $orderData['required_delivery_time'];
Re: PHP errors and warnings. PC 5 beta51. PHP 8.3
Posted: 18 Jun 2024, 16:22
by Jan
The code is the same on your instance, so hard to say why it does produce such errors. I will try to do more tests.
Jan