0

I intentionally set my error_reporting, so I see the E_DEPRECATED warnings while developing.

Now on some ocations those warnings are not shown: I successfully get the warning

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ... has a deprecated constructor

But only if the file time changed. If I reload the page, the warning is gone. If I touch the file again on the filesystem and then reload the page, it is there.

I know how to fix the error, but how do I turn this "feature" off?

What do I have to do to get the warning always?

rubo77
  • 19,527
  • 31
  • 134
  • 226
  • 1
    Sounds like it might be a caching issue. Are you using opcache or memcached or something like that? – mpen Apr 17 '20 at 00:36
  • How do those caches work? Do they filter error messages? I use php7.4 in this Docker image: https://hub.docker.com/r/tan3/php-apache – rubo77 Apr 17 '20 at 00:40
  • https://stackoverflow.com/questions/5612945/what-is-a-bytecode-cache-and-how-can-i-use-one-in-php – Phil Apr 17 '20 at 00:57
  • That Docker image you're using includes the `apcu` extension – Phil Apr 17 '20 at 00:59
  • 1
    The warning comes from the PHP compiler. The cache prevents recompiling the script, it saves the compiled version. – Barmar Apr 17 '20 at 01:07
  • So how do I turn this unwanted cache off during development? – rubo77 Apr 17 '20 at 05:44

1 Answers1

0

Just don't install opcache in your docker image, so edit this line:

  docker-php-ext-install -j$(nproc) intl mysqli soap gd zip opcache && \

to just

  docker-php-ext-install -j$(nproc) intl mysqli soap gd zip && \

and rebuild the image.

This will work for sure, but you probably can also edit the php.ini and disable opcache there

rubo77
  • 19,527
  • 31
  • 134
  • 226