PHP 7.4.28 deprecated error show only once. When I refresh/reload page, error is gone

Keywords: LAMP/MAMP/WAMP - Installers - Technical issue - Other

bndiagnostic ID: 0bd24882-c0b6-b933-80fa-c3cd17fb7cf5

Description:
Hi,
I have LAMP 7.4.28 installed in localmachine.

For debugging purposes I needed to purposely test for errors only to find this strange issue.

On a deprecated error, the error only shows once.
If I refresh the browser, the error does not show again.
The only way I can see the error again is if I restart the services.

Also, no deprecated errors are logged in:
/lampstack-7.4.28-0/apache2/logs/error_log

Other errors are logged.

How can I permanently turn on the errors (if they exist) and make them NOT disappear, unless I fix them?!

I google this but only found:
PHP error shows only once, disappear when refreshed - Stack Overflow (I don’t think its related to my issue)

This is the code I’m testing:

<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $field_name = 'test 1'; $field_name2 = 'test 2'; $text{$field_name} = $field_name; $text[$field_name2] = $field_name2; echo $text{$field_name}; echo "
"; echo $text[$field_name2]; ?>

I get the expected error
Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/username/lampstack-7.4.28-0/apache2/htdocs/www/error-test/phptest.php on line 10

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/username/lampstack-7.4.28-0/apache2/htdocs/www/error-test/phptest.php on line 13

Until I refresh the page, then the error does not show again.

Thanks

Hi @oliver5,

I recommend asking in a PHP or general forum as it does not seem related to the Bitnami configuration of the application.

Bet regards,
Michiel

Hi @michiel
Thank you very much for the reply.

I fixed this issue as soon as I disabled opcache

PHP has Op Cache enabled by these lines in {$INSTALL_DIR}/php/etc/php.ini:
opcache.enable=1
opcache.enable_cli=1

Disable those by making them = 0 instead.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.