调试PHP错误:Ajax聊天安装


Debugging PHP Error: Ajax Chat installation

无法运行Ajax聊天的安装脚本。函数调用似乎可以找到合适的$filename,所以我很难确定无效参数是什么

in file [ROOT]/phpbb/di/container_builder.php on line 291: file_put_contents(C:/inetpub/wwwroot/phpbb3/chat/../cache/container_C:/inetpub/wwwroot/phpbb3/chatslashdotdotslash.php): failed to open stream: Invalid argument

这是284-291:

protected function dump_container($container_filename)
{
    $dumper = new PhpDumper($this->container);
    $cached_container_dump = $dumper->dump(array(
        'class'         => 'phpbb_cache_container',
        'base_class'    => 'Symfony'Component'DependencyInjection'ContainerBuilder',
    ));
    file_put_contents($container_filename, $cached_container_dump);
}

$container_filename的函数调用是

protected function get_container_filename()
{
    $filename = str_replace(array('/', '.'), array('slash', 'dot'), $this->phpbb_root_path);
    return $this->phpbb_root_path . 'cache/container_' . $filename . '.' . $this->php_ext;
}

我认为$cached_container_dump的函数变量可能是问题所在,如上面第2行所示。我不确定是否找到base_class,因为它不在命名空间中。几天来我一直在努力遵循这个。。。任何帮助都将不胜感激。

var_dump($dumper)的结果如下:这是否意味着数组正在返回一个对象?

object(Symfony'Component'DependencyInjection'Dumper'PhpDumper)#13 (7) { ["inlinedDefinitions":"Symfony'Component'DependencyInjection'Dumper'PhpDumper":private]=> object(SplObjectStorage)#3325 (1) { ["storage":"SplObjectStorage":private]=> array(198) 

用以下函数替换file_put_contents函数:

file_put_contents($container_filename, $cached_container_dump, FILE_APPEND);

并确保$dumper->dump()函数返回一个字符串。

您必须将冒号替换为缓存文件名,因为它在windows上不是有效的文件名字符。