是否可以在PHP7下运行symfony 1.4?
如果是,那么必须进行哪些更改?
看看这个与你的问题有关的问题:Symfony 1.4 using deprecated functions in php 5.5
根据您的代码库,我认为您最好的选择是升级到Symfony 2或3.或者您可以使用支持5.6的项目(将来可能是7个?):https://github.com/LExpress/symfony1
对于那些想要使用symfony 1.4和PHP7的doctrine 1.2的人!
在%SF_LIB_DIR%/ vendor / symfony / lib / plugins / sfDoctrinePlugin / lib / vendor / doctrine / Doctrine / Collection.php第463行中,您将找到:
$record->$relation['alias'] = $this->reference;
在PHP 5中,这被解释为
$record->${relation['alias']} = $this->reference;
作者的意图。在PHP7中,它将被解释为
${record->$relation}['alias'] = $this->reference;
什么导致了关系的错误。
要解决此问题,只需隐式显式:
$record->{$relation['alias']} = $this->reference;
这个问题消失了。
此外,您必须更改以下Doctrine文件:Doctrine / Adapter / Statement / Oracle.php第586行
$query = preg_replace("/(\?)/e", '":oci_b_var_". $bind_index++' , $query);
至
$query = preg_replace_callback("/(\?)/", function () use (&$bind_index) { return ":oci_b_var_".$bind_index++; }, $query);
Doctrine / Connection / Mssql.php第264行来自
$tokens[$i] = trim(preg_replace('/##(\d+)##/e', "\$chunks[\\1]", $tokens[$i]));
至
$tokens[$i] = trim(preg_replace_callback('/##(\d+)##/',function ($m) use($chunks) { return $chunks[(int) $m[1]]; }, $tokens[$i] ));
和来自的415行
$query = preg_replace('/##(\d+)##/e', $replacement, $query);
至
$query = preg_replace_callback('/##(\d+)##/', function($m) use ($value) { return is_null($value) ? 'NULL' : $this->quote($params[(int) $m[1]]); }, $query);
因为PHP7没有preg修饰符'e'了。通过这些修改,doctrine 1.2将继续与PHP7一起使用,并且正在使用PHP5!