Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xml::build() BOM "\xEF\xBB\xBF" #11957

Closed
salines opened this issue Apr 17, 2018 · 2 comments
Closed

Xml::build() BOM "\xEF\xBB\xBF" #11957

salines opened this issue Apr 17, 2018 · 2 comments

Comments

@salines
Copy link

salines commented Apr 17, 2018

Just report,

i have unable to open and read some xml files with
Xml::build() method

UPDATE:

$file = new File($local_xml);
$f = $file->read()
$xml = Xml::build($f);

Error:

Exception: Xml cannot be read. in [/vagrant/vendor/cakephp/cakephp/src/Utility/Xml.php, line 168]

2018-04-17 17:37:03 Error: [Cake\Utility\Exception\XmlException] Xml cannot be read. in /vagrant/vendor/cakephp/cakephp/src/Utility/Xml.php on line 168
Stack Trace:
#0 /vagrant/vendor/cakephp/cakephp/src/Utility/Xml.php(123): Cake\Utility\Xml::_loadXml('\xEF\xBB\xBF<?xml versio...', Array)
#1 /vagrant/src/Shell/AubiplusShell.php(155): Cake\Utility\Xml::build('/vagrant/tmp/au...')
#2 /vagrant/src/Shell/AubiplusShell.php(136): App\Shell\AubiplusShell->local('/vagrant/tmp/au...', Object(SimpleXMLElement))
#3 /vagrant/src/Shell/AubiplusShell.php(78): App\Shell\AubiplusShell->remote('https://service...')
#4 /vagrant/src/Shell/AubiplusShell.php(69): App\Shell\AubiplusShell->auto()
#5 /vagrant/vendor/cakephp/cakephp/src/Console/Shell.php(507): App\Shell\AubiplusShell->main()
#6 /vagrant/vendor/cakephp/cakephp/src/Console/CommandRunner.php(141): Cake\Console\Shell->runCommand(Array, true)
#7 /vagrant/bin/cake.php(12): Cake\Console\CommandRunner->run(Array)
#8 {main}

but success with:

$xml = simplexml_load_file($local_xml);

CakePHP 3.5

@markstory
Copy link
Member

Does new SimpleXmlElement() work with your file?

@markstory markstory added this to the 3.6.1 milestone Apr 17, 2018
@markstory markstory modified the milestones: 3.6.1, 3.6.2. Apr 20, 2018
iliepandia added a commit to iliepandia/cakephp that referenced this issue Apr 25, 2018
@markstory
Copy link
Member

Closing as there is a pull request up to improve error handling making this issue easier to understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants