Symfony 1 中的 PHP 警告“警告:ob_start():函数 '' 未找到或函数名称无效”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10380932/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 22:03:40  来源:igfitidea点击:

PHP Warning "Warning: ob_start(): function '' not found or invalid function name" in Symfony 1?

phpsymfony1

提问by Tower

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

警告:ob_start():在第 155 行的 /symfony-1.3\lib\config\sfApplicationConfiguration.class.php 中找不到函数 '' 或无效的函数名称

This occurs with Symfony 1.x projects. I am using Apache 2.2 and PHP 5.4.1.

这发生在 Symfony 1.x 项目中。我使用的是 Apache 2.2 和 PHP 5.4.1。

The mentioned line has:

提到的行有:

ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : '');

回答by Emil Vikstr?m

Try using a nullvalue instead of the empty string.

尝试使用null值而不是空字符串。

ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : null);

回答by Roy Orpiano

-ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : '');

——ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : '');

+ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : null);

+ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : null);

回答by flu

This was fixed in symfony 1.4.16

这已在 symfony 1.4.16 中修复

See symfony 1.4.16 changelog:

参见symfony 1.4.16 更新日志

  • [...]
  • [33214] fixed ob_start() behavior on CLI (closes #9970)
  • [33208] fixed ob_start usage (to avoid warning in PHP 5.4, closes #9970)
  • [...]
  • [33214] 修复了 CLI 上的 ob_start() 行为(关闭 #9970)
  • [33208] 修复了 ob_start 的使用(为了避免在 PHP 5.4 中出现警告,关闭 #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.

最好使用最新/最后/最终发布的 symfony 1.x 版本,即 1.4.20。

You can grab them at the official Git mirror for symfony 1.x .

您可以在symfony 1.x 的官方 Git 镜像中获取它们。