0

I'm stuck on something that shouldn't exist. I have an each() warning that continuously pops up even though I've search in all of the Vendor's files and cannot find it.

This is my returned warning:

The each() function is deprecated. This message will be suppressed on further calls

To clarify, this is not my code, it is one of the Vendors packages used in a project I am working on, the unfortunate part is is that I have updated to the latest version of this code which was updated to specifically remove the each() function. That’s why I’m trying to locate where this error pops up at.

I do not get any additional information to locate where this issue might be located. What sort of configurations or error logging might I find useful?

halfer
  • 19,824
  • 17
  • 99
  • 186
Matthew
  • 1,565
  • 6
  • 32
  • 56
  • Have you seen this post? I'm not positive but it seems to be the same issue. https://stackoverflow.com/questions/51235163/php-7-2-each-function-is-deprecated – Andrew Cotton Feb 08 '19 at 06:15
  • From the [PHP manual](https://secure.php.net/manual/en/function.each.php): "_Warning: This function has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged._" Try changing your PHP version – brombeer Feb 08 '19 at 07:10
  • I’ve updated my question to clarify, this isn’t my code and I wouldn’t use each() anyways, just trying to locate where it is. – Matthew Feb 08 '19 at 13:13
  • Are you getting it in web or artisan command? In the latter, invoking with `-vvvv` often shows debug output and stacktraces. Also, set APP_DEBUG to `true` in your `.env`. – Tobias K. Feb 08 '19 at 13:17
  • @TobiasK. - through the web, and alright, I’m pretty sure that it’s set to debug but I’m heading in as it is and I’ll check here soon. – Matthew Feb 08 '19 at 13:28
  • @TobiasK. - Yes, my .env currently has APP_DEBUG = true and APP_LOG_LEVEL = debug – Matthew Feb 08 '19 at 14:48
  • Is this just a notice printed on the page, or does your site actually escalate this as an exception and show the error page? – Tobias K. Feb 08 '19 at 15:57
  • At the moment, it is just printed. Which isn't particularly helpful in my case... – Matthew Feb 08 '19 at 16:12
  • And my php.ini reports all errors as well as `display_errors` is set to `ON` – Matthew Feb 08 '19 at 16:21

2 Answers2

0

each() has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged.

Coder
  • 23
  • 8
  • 1
    I’ve updated my question to include that this isn’t my code, it used to be part of a package which has since removed the each() function, but somewhere, it remains. That’s why I’m trying to locate it... – Matthew Feb 08 '19 at 13:14
0

Are you using an IDE which allows you to search all source files in your project for "each("?

Otherwise, you might be able to use a command line tool to do the same. How to grep a string in a directory and all its subdirectories (Linux)

Luke G.
  • 587
  • 1
  • 4
  • 13
  • I've search through my IDE and I cannot find it, every mention of even just each( pops up with foreach(, which is what it was supposed to be after the update from the package manager. – Matthew Feb 08 '19 at 16:13
  • Can you search with regex? Something like ([^r]each\() might eliminate the foreach matches. – Luke G. Feb 08 '19 at 16:59