Menu

#402 (ok 2.11.6) headers already sent - config file with BOM

closed-accepted
None
1
2008-04-29
2008-04-16
No

A classic php error msg, which has been plaguing mysql since forever.

This time around it stems from 'something' being flushed to php stdout by the "eval" function in PMA_Config::Load(). It might be because my config file is coming from an old phpmyadmin version, it might be because of some cosmic particle traversing my laptop.

Of course, setcookie() does not work after that, and the php error is triggered.

Suggested patch: use ob_start/ob_end_clean to prevent the included file (its supposed to be a config after all) to hit stdout: in line 371 of config.class.php change to:

/**
* Parses the configuration file
*/
$old_error_reporting = error_reporting(0);
ob_start();
if (function_exists('file_get_contents')) {
$eval_result =
eval('?>' . trim(file_get_contents($this->getSource())));
} else {
$eval_result =
eval('?>' . trim(implode("\n", file($this->getSource()))));
}
ob_end_clean();
error_reporting($old_error_reporting);

Discussion

  • Marc Delisle

    Marc Delisle - 2008-04-16

    Logged In: YES
    user_id=210714
    Originator: NO

    Moved to patches.

     
  • Marc Delisle

    Marc Delisle - 2008-04-16
    • milestone: 824815 -->
    • labels: 509095 -->
     
  • Marc Delisle

    Marc Delisle - 2008-04-16

    Logged In: YES
    user_id=210714
    Originator: NO

    Could you attach here some "bad" config file that can trigger the problem with phpMyAdmin 2.11.5.1 ?

     
  • Marc Delisle

    Marc Delisle - 2008-04-16
    • assigned_to: nobody --> lem9
     
  • Gaetano Giunta

    Gaetano Giunta - 2008-04-16
     
  • Gaetano Giunta

    Gaetano Giunta - 2008-04-16

    Logged In: YES
    user_id=114789
    Originator: YES

    Here is the attached file.
    I presume it might be the newline after the closing '?>' that does it, or the BOM chars at the beginning of the file, as it looks quite valid to me...
    Note: my config is: php5.2.5 win, no output buffering (of course), mbstring on
    File Added: config.inc.php

     
  • Marc Delisle

    Marc Delisle - 2008-04-17

    Logged In: YES
    user_id=210714
    Originator: NO

    Merged, thanks. Bug only in the 2.11 branch (3.0 was ok).

     
  • Marc Delisle

    Marc Delisle - 2008-04-17
    • priority: 5 --> 1
    • summary: headers already sent - output started in config.class.php --> (ok 2.11.6) headers already sent - config file with BOM
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2008-04-17

    Logged In: YES
    user_id=210714
    Originator: NO

    Merged, thanks. Bug only in the 2.11 branch (3.0 was ok).

     
  • Marc Delisle

    Marc Delisle - 2008-04-29
    • status: open-accepted --> closed-accepted