6

bbPress has an annoying error about bbp_setup_current_user was called incorrectly. bbPress topic and bbPress ticket #2412, and it looks like nothing will change to fix it.

On the site we used to use forum as a support platform, but has since then moved to a ticket system, so I've closed the forums, but you can look through them. I've also commented out the notice that was thrown in the backend because of it, but the problem is that the error.log on the server is filled with such errors (it's 85MB during the last 4 days). It's all like this:

[Fri Aug 26 02:00:52.251831 2016] [:error] [pid 1832] [client xx.xx.xx.xx:32824] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'bbp_setup_current_user' not found or invalid function name in /var/www/html/wp-includes/plugin.php on line 524

So is there any kind of command I can use to suppress the writing of this specific warning in the error log? I'd still like to have possible errors written here.

6
  • how about fixing the bug? ;) Aug 26, 2016 at 6:27
  • The bug, as stated by the bbPress developers, is due to WordPress core issue. I can't fix that. It's not a theme issue ;)
    – dingo_d
    Aug 26, 2016 at 6:28
  • 1
    in general it will be hard to silence that specific error without silencing all other similar, or having to change your code on every bbpress update Aug 26, 2016 at 6:31
  • 1
    it is bullshit when someone produces code and calls it stable while it emits php warnings. The minimum that bbpress should do is to surpress the error. This is not "bbpress can not resolve it" this is "bbpress prefers someone else to put the effort to resolve it" Aug 26, 2016 at 6:44
  • and from actually reading the tickets, there is no way core will change behaviour, so at best JJJ is delusional, at worse he is lazy Aug 26, 2016 at 6:46

2 Answers 2

2

"Technically" it's just a PHP warning and not an error, and you should not have warnings enabled on production servers. You can disable PHP from logging warnings and it will still log errors to the error log file.

You can disable PHP warnings by setting it in a custom php.ini file on the server (all errors except for warnings): error_reporting = E_ALL & ~E_WARNING

or try setting it with PHP:

error_reporting(E_ALL & ~E_WARNING);

From php.ini file:

; Common Values:
;   E_ALL (Show all errors, warnings and notices including coding standards.)
;   E_ALL & ~E_NOTICE  (Show all errors, except for notices)
;   E_ALL & ~E_NOTICE & ~E_STRICT  (Show all errors, except for notices and coding standards warnings.)
;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; http://php.net/error-reporting
4
  • Sure, but I find - 'just disable error logging' approach a bit dishonest. Especially for a client. Anyways, it's probably a thing that bbPress developers should fix ultimately, don't know why they didn't...
    – dingo_d
    Jun 29, 2017 at 6:04
  • It's not dishonest, it's disabling warnings not errors ... and this would be a perfect use case scenario. I manage multiple racks in numerous data centers for clients ... you shouldn't have warnings enabled on a production servers anyways, those issues should be resolved before the site hits a production server.
    – sMyles
    Jun 29, 2017 at 6:54
  • I wasn't enabling them on production ;) But this was happening while developing, and was annoying :D
    – dingo_d
    Jun 29, 2017 at 7:59
  • Yeah in that case then you're going to be SOL until bbpress issues an update. .. if they do
    – sMyles
    Jun 29, 2017 at 14:47
0
/ Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

Check this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.