Giter Site home page Giter Site logo

CFPropertyList Problem about cfpropertylist HOT 14 CLOSED

teclib avatar teclib commented on June 4, 2024
CFPropertyList Problem

from cfpropertylist.

Comments (14)

ckruse avatar ckruse commented on June 4, 2024 1

Hi,

Ignacio Olivares [email protected] writes:

Now is working but I had to change the object creation from:
$plist = new CFPropertyList( dirname(FILE).'/sample.plist', CFPropertyList::FORMAT_BINARY );
to:
$plist = new CFPropertyList\CFPropertyList( dirname(FILE).'/sample.plist');

so the optional parameter that specifies the type of the file is giving me problems.

Did you use a full qualified name? Like this:

$plist = new CFPropertyList\CFPropertyList(dirname(__FILE__).'/sample.plist', CFPropertyList\CFPropertyList::FORMAT_BINARY);

You could also import the namespace using the use namespace.

Thank you very much for all your help Christian.

You're very welcome!

Regards,

Christian Kruse
http://ck.kennt-wayne.de/

from cfpropertylist.

ckruse avatar ckruse commented on June 4, 2024

Hm, can you upload an example plist? Is it only with binary plists or
only with XML plists or with both?

Best regards,
CK

from cfpropertylist.

lpotherat avatar lpotherat commented on June 4, 2024

I suggest also to share the error that it gives you, because "an error" could be everything.

from cfpropertylist.

ckruse avatar ckruse commented on June 4, 2024

If it is a bplist: does it contain a very large dictionary?

from cfpropertylist.

ijo avatar ijo commented on June 4, 2024

Thanks for your comments.
The error_log doesn't give any error, that's why it took me a little bit to realize that the error was when creating the new CFProperyList object.

Basically an iOS app writes a plist that it supossed to be binary in an sqlite file. Then, I read it doing a query an write the file sample.plist to the be readed by CFPropertyList. The code is the following:

$plist = new CFPropertyList( dirname(FILE).'/sample.plist', CFPropertyList::FORMAT_BINARY );

$plistarray = $plist->toArray();

$data_arr = ($plistarray['$objects']);

The curious thing is that when I write the sample.plist file for a certain configuration and this is about 320KB, the reading is succesful. However when the .plist is about 780KB it fails.
The size depends of the configuration on how much data the ipad reads to then write to the sqlite file.

As I can't attach the .plist I'm posting the header and a little part of the information in it.

$archiver NSKeyedArchiver $objects $null $class CF$UID 32770 NS.objects CF$UID 2

Sorry if I'm not very explicit but I'm not an expert.

Thank you very much.

from cfpropertylist.

ckruse avatar ckruse commented on June 4, 2024

@ijo sent me the plist causing problems, and after spending yesterday evening with debugging I found the problem. The problem is that in plists as large as this one the object ref size might get bigger than 3 bytes; I didn't think of this. I will fix a push this evening.

from cfpropertylist.

ckruse avatar ckruse commented on June 4, 2024

Hm, I was wrong. There is something else borky... looking for the problem again.

from cfpropertylist.

ckruse avatar ckruse commented on June 4, 2024

Ok, I think I found the problem: the size was not the problem but it contained a uid type entry. It should work now, can you confirm?

from cfpropertylist.

ijo avatar ijo commented on June 4, 2024

Yes. Let me replace the library file.
I'm curious because other files with less size also has uid types and they
work.

Let me try and I'll email you.

On Wed, Jan 28, 2015 at 5:20 PM, Christian Kruse [email protected]
wrote:

Ok, I think I found the problem: the size was not the problem but it
contained a uid type entry. It should work now, can you confirm?


Reply to this email directly or view it on GitHub
#30 (comment)
.

Ignacio J. Olivares

from cfpropertylist.

ijo avatar ijo commented on June 4, 2024

Now it throws the error:

Fatal error: Class 'CFPropertyList' not found in
------------/address.php on line 381

when I call: $plist = new CFPropertyList(
dirname(FILE).'/sample.plist', CFPropertyList::FORMAT_BINARY );

On Wed, Jan 28, 2015 at 5:19 PM, Christian Kruse [email protected]
wrote:

Closed #30 #30 via
2ea0483
2ea0483
.


Reply to this email directly or view it on GitHub
#30 (comment).

Ignacio J. Olivares

from cfpropertylist.

ckruse avatar ckruse commented on June 4, 2024

Are you sure that you correctly require() the classes/CFPropertyList/CFPropertyList.php file? This seems not to be an error on the library site, it seems as if the file hasn't been evaluated yet.

from cfpropertylist.

ijo avatar ijo commented on June 4, 2024

Don't know what's happening.

I'm using the same line as before: require_once(dirname(FILE).'/CFPropertyList/CFPropertyList.php');

And when I upload again the previous version of the classes it works.

The problem seems to be with the new CFPropertyList.php file.

from cfpropertylist.

ckruse avatar ckruse commented on June 4, 2024

Hm, did you forget to import or mention the namespace? For me it simply works:

→ ckruse@sunshine ~  % git clone https://github.com/rodneyrehm/CFPropertyList.git
Cloning into 'CFPropertyList'...
remote: Counting objects: 400, done.
remote: Total 400 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (400/400), 81.58 KiB | 0 bytes/s, done.
Resolving deltas: 100% (218/218), done.
Checking connectivity... done.
→ ckruse@sunshine ~  % cat test.php                                              
<?php
require("./CFPropertyList/classes/CFPropertyList/CFPropertyList.php");
var_dump(new CFPropertyList\CFPropertyList());

→ ckruse@sunshine ~  % php test.php
object(CFPropertyList\CFPropertyList)#1 (18) {
  ["file":protected]=>
  NULL
  ["detectedFormat":protected]=>
  int(0)
  ["format":protected]=>
  int(0)
  ["value":protected]=>
  array(0) {
  }
  ["iteratorPosition":protected]=>
  int(0)
  ["iteratorKeys":protected]=>
  NULL
  ["content":protected]=>
  NULL
  ["pos":protected]=>
  int(0)
  ["uniqueTable":protected]=>
  array(0) {
  }
  ["countObjects":protected]=>
  int(0)
  ["stringSize":protected]=>
  int(0)
  ["intSize":protected]=>
  int(0)
  ["miscSize":protected]=>
  int(0)
  ["objectRefs":protected]=>
  int(0)
  ["writtenObjectCount":protected]=>
  int(0)
  ["objectTable":protected]=>
  array(0) {
  }
  ["objectRefSize":protected]=>
  int(0)
  ["offsets":protected]=>
  array(0) {
  }
}
→ ckruse@sunshine ~  % 

from cfpropertylist.

ijo avatar ijo commented on June 4, 2024

Now is working but I had to change the object creation from:
$plist = new CFPropertyList( dirname(FILE).'/sample.plist', CFPropertyList::FORMAT_BINARY );
to:
$plist = new CFPropertyList\CFPropertyList( dirname(FILE).'/sample.plist');

so the optional parameter that specifies the type of the file is giving me problems.

Thank you very much for all your help Christian.

from cfpropertylist.

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.