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

Error reading large plist files #33

Open
jacobraccuia opened this issue Sep 16, 2015 · 6 comments
Open

Error reading large plist files #33

jacobraccuia opened this issue Sep 16, 2015 · 6 comments
Assignees
Projects
Milestone

Comments

@jacobraccuia
Copy link

thanks for the plist reader!

I am using a form to have users submit their itunes.xml plist to the site, which then parses the data and displays statistics about their listening habits.

It works fine when uploaded files ~ 20mb, but a 72mb is throwing the following error.

Warning: DOMDocument::loadXML(): (null)(null)xmlSAX2Characters: out of memory in Entity, line: 538384 in ..../classes/CFPropertyList/CFPropertyList.php on line 267.

I've increased the memory on my php server to 528mb and have a long time out to help troubleshoot this, but I didn't get anywhere.

You can test it yourself at:
http://jacobraccuia.com/most_listened.php

Is this a server error or bug here?

Thanks

@lpotherat
Copy link
Contributor

I think CFPropertyList will not be able to read large files, because it is not a stream parser. Even if we parse the xml with stream based parser, the class will still store all the informations in memory, wich is impossible with large files.
A stream based CFPropertyList reader could be fine, but it's a lot of work !

@YannickGagnon
Copy link

Hey @jacobraccuia, it's not a bug and it's not really a server error either. Once you load a file into CFPropertyList, it will start creating object oriented entities for all objects. Unfortunately, there is no other option than storing them into memory. As I see it, you have two options: You either increase your memory limit, execution time limit and you limit the size of the file upload or you work directly in XML with XPath.

Hope this helps

@jasper2virtual
Copy link
Contributor

jasper2virtual commented Sep 15, 2017

Hi @lpotherat ,
I understood, CFPropertyList is not a stream parser, I have a headache problem too. My project plist files are very large.
I have a idea, is it possible to use another stream reader to read my plist file first. to read each repeating node, then pass the node xml text into CFPropertyList.
For example:

  1. use XMLReader to parse my plist file
  2. in the XMLReader reading loop, each time I capture a node I want, I pass it to create a new CFPropertyList object by loadXMLStream?
    is it possible? anyway I will try it today.

@lpotherat
Copy link
Contributor

lpotherat commented Oct 30, 2017

Sorry for the late answer, do you have any news on your tests ? @jasper2virtual

@jasper2virtual
Copy link
Contributor

Hi @lpotherat ,
Oh yes, I have tried it and create the pull request
#37

@rodneyrehm
Copy link
Collaborator

Please note that per #36 we're looking for someone to take over maintenance of this project. I have moved on from PHP and neither the time nor the desire to keep working on CFPropertyList.

@ajsb85 ajsb85 added the bug label Apr 18, 2018
@ajsb85 ajsb85 added this to Backlog in Package Apr 18, 2018
@ajsb85 ajsb85 moved this from Backlog to General bugs in Package Apr 18, 2018
@ajsb85 ajsb85 moved this from General bugs to Backlog in Package Apr 18, 2018
@ajsb85 ajsb85 added this to the 3.0 milestone Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Package
  
To do
Development

No branches or pull requests

8 participants