Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created a small plugin to test database interactions in wordpress. I have a small function that inputs the arguments to the table.

If i call my function in a themefile it inputs my test values to my table, but if i call it from another plugin i get this error:

Notice: ob_end_flush(): failed to send buffer of zlib output compression (0) in /.../wp-includes/functions.php on line 2504

I have no idea what this error means, can anyone shed some light on it?

edit: I use MAMP with PHP 5.4.4

edit2:

function test_db_function($name, $message){
  global $wpdb;
  $table_name = $wpdb->prefix . "testDB";

  if( $name == '' || $message == '' || !isset($name) || !isset($message)) {
    //return 0;
  }
  else{
    $rows_affected = $wpdb->insert( $table_name, array( 
      'time' => time(), 
      'name' => $name, 
      'text' => $message) );
  }
}
share|improve this question

1 Answer 1

You did not provide that information, so I have to guess a little bit: You are using PHP 5.4 and zlib.output_compression is on on your server?

Then you just stumbled upon bug #18525. Possible solutions:

  • Disable zlib.output_compression.
  • Apply the patch provided there and report back on that ticket if it works.
  • Disable notices.

What you can do when you decide to release the plugin to the public is another issue …

share|improve this answer
    
Thank you for a quick response, realized i provided a little information. I use PHP 5.4.4 in MAMP. –  andeersg Oct 26 '12 at 19:57
    
I see that bug happens on auto-updates of plugins. I get the notice when calling a function from my plugin, and the function is not performed. –  andeersg Oct 26 '12 at 20:07
1  
Same problem here - I found that adding ini_set('zlib.output_handler', ''); at the top of my plugin solved it. –  adam Jun 4 '13 at 20:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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