Page 1 of 1

Weird error and problem when updating one particular product

Posted: Fri Oct 31, 2025 2:58 pm
by 14Steve14
We have one product, that has been on the website for many years which every time we update the stock gives a "This age is not working" error after increasing the stock. The funny thing is the product does update.

The error in the error logs is the following
[31-Oct-2025 14:38:52 Europe/London] PHP Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /#####/#####/#####/includes/system/versioned/1.0.5.1/customer.php:52
Stack trace:
#0 /#####/#####/#####/includes/system/versioned/1.0.5.1/customer.php(52): array_filter()
#1 /#####/#####/#####/includes/system/versioned/1.0.5.1/customer.php(79): customer->fetch_address()
#2 /#####/#####/#####/includes/system/versioned/1.0.5.1/customer.php(97): customer->fetch_to_address()
#3 /#####/######/#####/includes/modules/outgoing/update_stock.php(46): customer->get()
#4 /#####/railways/#####/includes/hooks/admin/catalog/injectQueue.php(34): osC_Outgoing_update_stock::system_add()
#5 /#####/#####/#####/includes/system/versioned/1.0.8.1/hooks.php(150): hook_admin_catalog_injectQueue->listen_updateProductAction()
#6 /#####/#####/#####/#####/includes/segments/process_action.php(20): hooks->cat()
#7 /#####/#####/#####/#####/catalog.php(32): require('/home/#####/...')
#8 {main}
thrown in /#####/#####/#####/includes/system/versioned/1.0.5.1/customer.php on line 52
Line 52 in the file is

Code: Select all

$this->data[$to] = array_filter($address_query->fetch_assoc(), function ($v) { return !Text::is_empty($v); });
ChatGPT come up with the following as a reason for the error.
Why it only happens for that product

That’s the interesting part.

It’s not actually the product that’s wrong — it’s more likely:

That particular product is included in an old queue entry or linked to a missing customer record (e.g. a historical order or stock sync event).

When you update its stock, a hook fires that tries to update an external system (through osC_Outgoing_update_stock::system_add()), and that hook requests customer details — even though none exist.

So the “product update works” (stock changes saved), but the queue creation fails because the hook crashes while trying to build the message payload.
Is anyone able to shed any light on this error and problem.

Re: Weird error and problem when updating one particular product

Posted: Fri Oct 31, 2025 3:03 pm
by BrockleyJohn
I think the error relates to a particular customer who's subscribed to the product and their default address doesn't exist.

You'll need to do some querying to figure out which.

Re: Weird error and problem when updating one particular product

Posted: Fri Oct 31, 2025 3:04 pm
by BrockleyJohn
...or the subscription exists but not the customer

Something along those lines anyway

Re: Weird error and problem when updating one particular product

Posted: Fri Oct 31, 2025 3:47 pm
by 14Steve14
@BrockleyJohn

Found it. We had a customer in the products notifications list who had been deleted but still remained in the notifications table. Now to update the delete customer code to make sure this is also deleted, which is the easy bit.