Comments (14)
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.
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.
I suggest also to share the error that it gives you, because "an error" could be everything.
from cfpropertylist.
If it is a bplist: does it contain a very large dictionary?
from cfpropertylist.
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 2Sorry if I'm not very explicit but I'm not an expert.
Thank you very much.
from cfpropertylist.
@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.
Hm, I was wrong. There is something else borky... looking for the problem again.
from cfpropertylist.
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.
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.
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.
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.
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.
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.
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)
- CFPropertyList object is not serializable HOT 3
- Add documentation and more examples
- Assistance with example HOT 3
- Packagist package has the wrong name HOT 1
- new CFNumber(0) = format error HOT 4
- TypeDetecting Dictionary fails HOT 1
- Error reading large plist files HOT 6
- Maintainers Wanted HOT 12
- Information for project site HOT 1
- DevOps tasks
- HTML-Proofer found 2 failures
- Uncaught exception HOT 9
- How to disable base64 decoding? HOT 2
- Package does not auto-update on packagist HOT 2
- Output of toXML() for <real>s is locale-dependent and causes creation of invalid PList-XML HOT 4
- PHP 8.1 Compatibility HOT 23
- `CF$UID` cannot be squashed to integer HOT 2
- Can I directly use plist data in variables? HOT 1
- CFDictionary should not allow adding empty keys
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 cfpropertylist.