问题
Why am I getting:
Warning: ob_start(): function '' not found or invalid function name in /symfony-1.3\lib\config\sfApplicationConfiguration.class.php on line 155
This occurs with Symfony 1.x projects. I am using Apache 2.2 and PHP 5.4.1.
The mentioned line has:
ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : '');
回答1:
Try using a null
value instead of the empty string.
ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : null);
回答2:
-ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : '');
+ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : null);
回答3:
This was fixed in symfony 1.4.16
See symfony 1.4.16 changelog:
- [...]
- [33214] fixed ob_start() behavior on CLI (closes #9970)
- [33208] fixed ob_start usage (to avoid warning in PHP 5.4, closes #9970)
So simply make sure to use at least that version.
Preferably use the latest/last/final symfony 1.x version released, which is 1.4.20.
You can grab them at the official Git mirror for symfony 1.x .
来源:https://stackoverflow.com/questions/10380932/php-warning-warning-ob-start-function-not-found-or-invalid-function-name