3

I switched from PHP 7.0 to PHP 7.2 and getting hundreds of "Warning: Use of undefined constant ..." messages. Yes I know I have to fix it but that's not doable as fast as I want to.

Looks like php_flag display_errors off via htaccess is not working in this case.

Any ideas?

Oliver
  • 156
  • 1
  • 13
  • 8
    Don't disable warnings and errors - fix them - if you have ya time frame to stick to, fix them still. Otherwise you'll spend forever playing catch up, release stable production code - not buggy code – treyBake Aug 02 '19 at 15:18
  • 1
    Why would it not be doable? How many of these warnings do you get? – Dharman Aug 02 '19 at 15:20
  • 2
    We can all agree that this warnings should be fixed as soon as possible. However, your question is not very clear. Why are you looking into htacess flags? Why can't you fix them immediately? Why do you mean that it is not working just in this case? – Dharman Aug 02 '19 at 15:26
  • @Dharman Because it's a big project with hundreds of sub pages that someone else programmed long time ago. Of course I will fix them but that's not a quick "find & replace". That's why I want to hide - for the moment - the messages. But looks like it's not possible so I switch back to 7.0 fix and again 7.2 thx anyhow – Oliver Aug 02 '19 at 15:43
  • You could ignore all warnings, but I don't think you can pick and chose. Even in PHP 7.0 it would generate notice. – Dharman Aug 02 '19 at 15:44
  • Nope, in 7.0 it's hidden with this flag in htaccess @Dharman That's why I was so surprised to see it now. – Oliver Aug 02 '19 at 15:49
  • 2
    https://www.php.net/manual/en/migration72.deprecated.php#migration72.deprecated.unquoted-strings - In previous PHP versions issued a notice which you didn't see because you likely had notices turned off. In PHP 7.2, the notices have been *upgraded* to warnings which is why you're seeing them now. In the next major release, they will throw exceptions. – waterloomatt Aug 02 '19 at 15:58
  • 1
    You can use `error_reporting(E_ALL ^ E_WARNING);` to show all errors except warnings. – waterloomatt Aug 02 '19 at 16:04

0 Answers0