6

I have some code that's encrypted with ioncube and it's also written for < PHP 5.3. There's a ton of deprecated code, which would still work, but there's error messages all over the site.

Is there a way of externally forcing error_reporting to E_ALL ^ E_DEPRECATED or similar? I'm sure in the code they're hardcoding to E_ALL for some reason.

Noodles
  • 900
  • 4
  • 14
  • 30

2 Answers2

1

Disable display_errors and log them to a file instead. That is standard procedure for any production web site.

In an Apache config file, php_admin_value error_reporting X should make it impossible to be overridden by user code, where X is the integer value you want.

Also, set_error_handler() might be of use if you want to do some runtime checks.

Matthew
  • 47,584
  • 11
  • 86
  • 98
  • Unfortunately this isn't working for me. I've tried adding php_admin_value error_reporting 22519 (which is the int value of E_ALL & ~E_NOTICE & ~E_DEPRECATED) to my httpd.conf under the virtualhost section. I can see it working though. If I run a phpinfo() then error_reporting shows up as I specify in the local value. It seems though that the error_reporting function overrides php_admin_value (where ini_set can't). – Noodles Oct 05 '10 at 21:20
  • I think the application I'm using already sets an error handler. I ended up rolling back to PHP 5.2 so the application would work. Thanks for your help anyway. – Noodles Oct 06 '10 at 20:39
1

Rolled back to PHP 5.2 and avoided the problem.

Noodles
  • 900
  • 4
  • 14
  • 30