Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47398 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3883 invoked from network); 18 Mar 2010 16:30:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2010 16:30:26 -0000 Received: from [127.0.0.1] ([127.0.0.1:9380]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 86/87-20429-22552AB4 for ; Thu, 18 Mar 2010 11:30:26 -0500 X-Host-Fingerprint: 69.129.20.250 h69-129-20-250.wyngmi.dedicated.static.tds.net Received: from [69.129.20.250] ([69.129.20.250:14888] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/96-20429-EC352AB4 for ; Thu, 18 Mar 2010 11:24:46 -0500 Message-ID: <56.96.20429.EC352AB4@pb1.pair.com> To: internals@lists.php.net Reply-To: "Ben DeMott" Date: Thu, 18 Mar 2010 12:24:00 -0400 Lines: 44 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049 X-Posted-By: 69.129.20.250 Subject: PHP Variable Storage / DBUS From: ben.demott@gmail.com ("Ben DeMott") Hello to the php developer community - :) This is my first post so I hope I'm not too out of line coming here to ask a question. My question is - With PHP could a C extension be written that takes the binary contents of a variable in memory and writes it to a file or a stream? Like: struct abc{ int a;}X; FILE*fp = fopen("abc.dat","wb"); fwrite(&X,sizeof(X),1,fp); Basically I'm interested in using DBUS with PHP - Someone is already working on an implementation ... My question is could you take any arbitrary variable and send it over DBUS in its C binary form. That way 'the other side' of the DBUS connection could implement a similar construct and interpret the binary data to its language-specific format. This could go a long way to provide various forms of inter-process-communication in a binary fashion to other Languages (such as Python). To start out with I would like to experiment with serialization of a variable to a binary file - and see if I can get that working. I realize there are some limitations here - recursive structures, references, object references, pointer pointers - etc, I just don't know how PHP implements it's data structures well enough to know how hard retrieving simple arrays, integers, and strings from the applications memory would be. Binary serialization is ideal because it eliminates any problems associated with multi-byte strings, parsing overhead, etc. It would be great if a PHP arrays structure could be taken from memory, written to a file or stream, and opened in Python as a Dictionary without any database or serialization inbetween. If this overlaps with any current development please let me know. Thanks, Ben DeMott