PHP-EACH-001

each($array)

each() / create_function() / ereg / split

These PHP functions were removed long before Joomla 6. Joomla 4 already needs PHP 7.2+; Joomla 5 needs 8.1; Joomla 6 needs 8.3. Old extension code still contains them.

each($array)foreach / closures / preg_*

Dies at Joomla 3 → 4J3: Works nativelyJ4: Removed — fatalJ6: Removed — fatalBC plugin: no — already dead on J4Patch possible — review itPHP

What you will see

  • Call to undefined function each()
  • Call to undefined function create_function()
  • Call to undefined function ereg()
  • Call to undefined function split()
  • Call to undefined function get_magic_quotes_gpc()

Symptoms people search

php 8 fatal in a helper file

Replace this code

Swap each($array) for foreach / closures / preg_*.

Joomla 3

Remove or stop calling this

while (list($k, $v) = each($rows)) { }
$fn = create_function('$a', 'return $a;');

Joomla 4 / 6

Use this instead

foreach ($rows as $k => $v) { }
$fn = static fn ($a) => $a;

How to fix it

  1. 1each() → foreach.
  2. 2create_function() → a closure.
  3. 3ereg/split → preg_match / explode / preg_split.
  4. 4get_magic_quotes_gpc() → delete; filter input instead.

Also known as

each · create_function · ereg · split · magic_quotes

Related issues

Get in touch

Have a project in mind? Let's talk about it.

Tell us what you're building. Whether it's a new site, an online store, a mobile app, or something that needs AI under the hood, we'll get back to you within a business day.

Free consultation
No commitment, no pressure
Reply within 24 hours
Usually much faster

Prefer a direct conversation?

Request a project quote

Tell us about your project

Fill out the quick form and we'll reach out.