random error symfony:ContextErrorException: Warning: simplexml_load_file(): I/O warning : failed to load external entity

梦想的初衷 提交于 2019-12-10 10:45:44

问题


In my project with Symfony, I have this random error appear when I go to random page in my application:

ContextErrorException: Warning: simplexml_load_file(): I/O warning : failed to load external entity "C:\wamp\www\Symfony\vendor\friendsofsymfony\user-bundle\Resources\config\doctrine\model/User.orm.xml" 

in C:\wamp\www\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\Driver\XmlDriver.php line 736

Refresh the page many times seems to disable this error until it appears again.

I think, Symfony try to load .xml format but FOSUserBundle is in .yml.

I use Symfony 2.5.6, and the 5.5.12 php version with WAMP Server.

For now, this error is not disturbing my application developpement, but I would like to find the solution anyway. I don't understand why I have this error now.

The only things change in my application is that I insert some datas in my database with SQL request (in fact I use some data which already exist in another database, I have to import them in my new database with SQL on PhpMyAdmin, but nothing came wrong with SQL when I inserted them). The import worked well and there's no mistake with the datas of my database project.


回答1:


Hi @Julien FOSUser issue#1062 and symfony2 issue#7291 will help to resolve your problem.




回答2:


the line 707 XmlDrive.php has to changed form:

$xmlElement = simplexml_load_file($file);

to

$xmlElement = @simplexml_load_file($file);

This is a strange solution but it works!

NB: pay attention when updating your bundles...



来源:https://stackoverflow.com/questions/27035821/random-error-symfonycontexterrorexception-warning-simplexml-load-file-i-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!