Comments (12)
@Fossil01 Thanks for reporting this issue. An old pull request consider removing utf8_encode
to solve a "bug".
Could you try to remove this call and see if that solve the problem ? If not I will try to fix this issue this weekend.
from php-mediainfo.
@mhor nope same thing happens if I remove those 3 lines.
from php-mediainfo.
Thanks for your quick answer, so it's definitively related to xml string returned by mediainfo.
This is looking as an acceptable solution for me, I will try to implement this as soon as possible but if you want feel free to open a pull request with your solution I will be happy to review it.
from php-mediainfo.
I'll have a crack at it after Christmas. Cheers.
from php-mediainfo.
@Fossil01 did you have test the fix I've done (PR #93) ?
from php-mediainfo.
Completely forgot about this. It seems to work now.
from php-mediainfo.
Looks like I am still having this issue.
ErrorException
simplexml_load_string(): Entity: line 10: parser error : Char 0xFFFE out of allowed range
at vendor/mhor/php-mediainfo/src/Parser/AbstractXmlOutputParser.php:18
14| if (mb_detect_encoding($xmlString, 'UTF-8', true) === false) {
15| $xmlString = utf8_encode($xmlString);
16| }
17|
> 18| $xml = simplexml_load_string($xmlString);
19| $json = json_encode($xml);
20|
21| return json_decode($json, true);
Maybe we can use a function like this to strip out invalid chars:
https://stackoverflow.com/a/3466049
from php-mediainfo.
Aha. It looks like aca1198 never made it into the master branch and thus in a release.
When I add these lines it seems to fix the issue too:
$xmlString = preg_replace(
'/[\x00-\x08\x0B\x0C\x0E-\x1F]|\xED[\xA0-\xBF].|\xEF\xBF[\xBE\xBF]/',
"\xEF\xBF\xBD",
$xmlString
);
from php-mediainfo.
XML it fails on currently:
<?xml version="1.0" encoding="UTF-8"?>
<Mediainfo version="20.03">
<File>
<track type="General">
<Count>331</Count>
<Count_of_stream_of_this_kind>1</Count_of_stream_of_this_kind>
<Kind_of_stream>General</Kind_of_stream>
<Kind_of_stream>General</Kind_of_stream>
<Stream_identifier>0</Stream_identifier>
<Complete_name>/mnt/ramdisk/1/15f4594a-c211-4acc-9f58-cae2b09c8151/160095_[� Kuro Ookami ] Pet Life [ISO DVD-RIP 1920x1080 x264 10bits AC-3] [69A9399D].mkv</Complete_name>
<Folder_name>/mnt/ramdisk/1/15f4594a-c211-4acc-9f58-cae2b09c8151</Folder_name>
<File_name_extension>160095_[� Kuro Ookami ] Pet Life [ISO DVD-RIP 1920x1080 x264 10bits AC-3] [69A9399D].mkv</File_name_extension>
<File_name>160095_[� Kuro Ookami ] Pet Life [ISO DVD-RIP 1920x1080 x264 10bits AC-3] [69A9399D]</File_name>
<File_extension>mkv</File_extension>
<File_size>1048394</File_size>
<File_size>1 024 KiB</File_size>
<File_size>1 024 KiB</File_size>
<File_size>1 024 KiB</File_size>
<File_size>1 024 KiB</File_size>
<File_size>1 023.8 KiB</File_size>
<Stream_size>1048394</Stream_size>
<Stream_size>1 024 KiB (100%)</Stream_size>
<Stream_size>1 024 KiB</Stream_size>
<Stream_size>1 024 KiB</Stream_size>
<Stream_size>1 024 KiB</Stream_size>
<Stream_size>1 023.8 KiB</Stream_size>
<Stream_size>1 024 KiB (100%)</Stream_size>
<Proportion_of_this_stream>1.00000</Proportion_of_this_stream>
<File_last_modification_date>UTC 2021-10-13 08:47:31</File_last_modification_date>
<File_last_modification_date__local_>2021-10-13 10:47:31</File_last_modification_date__local_>
</track>
</File>
</Mediainfo>
from php-mediainfo.
@Fossil01 Oops I don't know why I've never merge #93. I've open a new PR (#128). Could you check if it fix the bug.
from php-mediainfo.
I'll have a look this week, thanks. In the mean time I manually edited the file in the vendor dir and added that preg_replace I pasted here before as an ugly temp fix :-)
from php-mediainfo.
Closed for now, due to inactivity.
from php-mediainfo.
Related Issues (20)
- Process does not work on Windows / wrong ENV-definition
- Exception when using getInfo function HOT 1
- error simplexml_load_string() HOT 1
- Error when trying to parse result of __toXML() HOT 1
- fix php8 require deps HOT 1
- Error in MediaInfoOutputParser.php HOT 1
- ErrorException: Undefined index: track in /var/www/vendor/mhor/php-mediainfo/src/Parser/MediaInfoOutputParser.php:46 HOT 2
- Windows HOT 7
- Symfony 6 components
- Your update version 5.5.0 gives simplexml_load_string parses error HOT 1
- Migrate configuration to object
- Parse JSON output of mediainfo
- Migrate code to php 8.1
- Remove compatibility layer for config
- Remove compatibility layer for XML parser
- Support symfony/filesystem v7.0 HOT 1
- Update dependencies HOT 2
- Convert code to php7
- Only support new version of mediainfo
- Remove compatibility layers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-mediainfo.