Code Monkey home page Code Monkey logo

Comments (12)

mhor avatar mhor commented on July 30, 2024

@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.

Fossil01 avatar Fossil01 commented on July 30, 2024

@mhor nope same thing happens if I remove those 3 lines.

from php-mediainfo.

mhor avatar mhor commented on July 30, 2024

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.

Fossil01 avatar Fossil01 commented on July 30, 2024

I'll have a crack at it after Christmas. Cheers.

from php-mediainfo.

mhor avatar mhor commented on July 30, 2024

@Fossil01 did you have test the fix I've done (PR #93) ?

from php-mediainfo.

Fossil01 avatar Fossil01 commented on July 30, 2024

Completely forgot about this. It seems to work now.

from php-mediainfo.

Fossil01 avatar Fossil01 commented on July 30, 2024

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.

Fossil01 avatar Fossil01 commented on July 30, 2024

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.

Fossil01 avatar Fossil01 commented on July 30, 2024

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.

mhor avatar mhor commented on July 30, 2024

@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.

Fossil01 avatar Fossil01 commented on July 30, 2024

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.

mhor avatar mhor commented on July 30, 2024

Closed for now, due to inactivity.

from php-mediainfo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.