Page 1 of 1
Error on Login
Posted: Sun Aug 03, 2025 11:34 am
by radhavallabh
Hi;
Version 1.1.0.4
When a customer is logging in I am getting this funny error-
Warning: array_filter() expects parameter 1 to be array, null given in /xx/xx/includes/system/versioned/1.0.5.1/customer.php on line 52
I checked database though fields are not filled in customer and address book but there is no wrong value in any column, only the defaults for the ones that are empty.
Any fix pls.. When I googled it says null check is required but cannot figure out where to begin as it is a core file.
Thank you for help in advance;
Warm Regds./
radhavallabh
Re: Error on Login
Posted: Sun Aug 03, 2025 1:35 pm
by burt
This for all customers?
Just one customer?
Can you rewrite this:
> I checked database though fields are not filled in customer and address book but there is no wrong value in any column, only the defaults for the ones that are empty.
As I can't understand if you have customer fields or if they are blank.
Re: Error on Login
Posted: Sun Aug 03, 2025 1:52 pm
by radhavallabh
burt wrote: ↑Sun Aug 03, 2025 1:35 pm
This for all customers?
Just one customer?
Can you rewrite this:
> I checked database though fields are not filled in customer and address book but there is no wrong value in any column, only the defaults for the ones that are empty.
As I can't understand if you have customer fields or if they are blank.
Hi;
I elaborate as below-
I have the fields but some are blank or have default value.
This for some customers specially those through Paypal and Old ones from previous database-
Have attached the pics from sql, some have partial empty fields in customer table and I attach example of address book customers missing state field for example.
Thank you in advance;
Warm Regds./
radhavallabh
Re: Error on Login
Posted: Sun Aug 03, 2025 2:06 pm
by burt
All customers?
One customer?
Re: Error on Login
Posted: Sun Aug 03, 2025 2:09 pm
by radhavallabh
burt wrote: ↑Sun Aug 03, 2025 2:06 pm
All customers?
One customer?
Not all-Those with all filled fields are logging in correctly. Only those from Paypal Login and Those with some missing fields like state in address book or telephone from customers table.
Re: Error on Login
Posted: Sun Aug 03, 2025 3:12 pm
by ecartz
It's telling you that some of your customers have no valid default address. If you go through the database and set the customers_default_address_id (on the customers table) to one of the addresses in the address_book for that customer, it should fix it.
Start with
Code: Select all
SELECT customers_id, customers_default_address_id FROM customers WHERE customers_default_address_id = 0
then
Code: Select all
SELECT customers_id, customers_default_address_id FROM customers WHERE customers_default_address_id IS NULL
then
Code: Select all
SELECT c.customers_id, c.customers_default_address_id FROM customers c LEFT JOIN address_book ab ON c.customers_id = ab.customers_id AND c.customers_default_address_id = ab.address_book_id WHERE ab.address_book_id IS NULL
That will tell you which customers have the problem.
For each of those, you can do
Code: Select all
SELECT * FROM address_book WHERE customers_id =
and add the customer ID at the end. That will tell you what addresses they have available. If you do this in another window, you can update the customers_default_address_id directly in the search results from the previous queries.
If you want to try to hack around it, you can change line 52 of from
Code: Select all
$this->data[$to] = array_filter($address_query->fetch_assoc(), function ($v) { return !Text::is_empty($v); });
to
Code: Select all
$this->data[$to] = array_filter($address_query->fetch_assoc() ?? [], function ($v) { return !Text::is_empty($v); });
which will at least quiet that error.
The reason why core does not do that is that that error is telling you that something is wrong with the customers_default_address_id. It would be better to fix that problem, as it will cascade out to other problems.
Re: Error on Login
Posted: Mon Aug 04, 2025 4:01 am
by radhavallabh
ecartz wrote: ↑Sun Aug 03, 2025 3:12 pm
It's telling you that some of your customers have no valid default address. If you go through the database and set the customers_default_address_id (on the customers table) to one of the addresses in the address_book for that customer, it should fix it.
Start with
Code: Select all
SELECT customers_id, customers_default_address_id FROM customers WHERE customers_default_address_id = 0
then
Code: Select all
SELECT customers_id, customers_default_address_id FROM customers WHERE customers_default_address_id IS NULL
then
Code: Select all
SELECT c.customers_id, c.customers_default_address_id FROM customers c LEFT JOIN address_book ab ON c.customers_id = ab.customers_id AND c.customers_default_address_id = ab.address_book_id WHERE ab.address_book_id IS NULL
That will tell you which customers have the problem.
For each of those, you can do
Code: Select all
SELECT * FROM address_book WHERE customers_id =
and add the customer ID at the end. That will tell you what addresses they have available. If you do this in another window, you can update the customers_default_address_id directly in the search results from the previous queries.
If you want to try to hack around it, you can change line 52 of from
Code: Select all
$this->data[$to] = array_filter($address_query->fetch_assoc(), function ($v) { return !Text::is_empty($v); });
to
Code: Select all
$this->data[$to] = array_filter($address_query->fetch_assoc() ?? [], function ($v) { return !Text::is_empty($v); });
which will at least quiet that error.
The reason why core does not do that is that that error is telling you that something is wrong with the customers_default_address_id. It would be better to fix that problem, as it will cascade out to other problems.
Thank you so much dear;
Fixing this problem right away...
Very Warm Regds,./
radhavallabh