Error on Login

Open to all! Ask other shopowners for help.
Post Reply
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Error on Login

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Error on Login

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Re: Error on Login

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Error on Login

Post by burt »

All customers?
One customer?
I am not here to build for you.
I am here to build with you. Let's help each other.
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Re: Error on Login

Post 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.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Error on Login

Post 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.
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Re: Error on Login

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply