I'm working on a PECL extension to implement proper AMF3 serialization for
objects.  I have two major questions.

1) HOW DO I DISTINGUISH ORTHODOX OBJECT PROPERTIES FROM DYNAMICALLY
ASSIGNED ONES?
According to the spec, objects are serialized differently if they contain
only the 'orthodox' properties of a class then they are if they contain
dynamic qualities assigned in an ad-hoc fashion. For example if I define a
class like this:

class foo {
  public $orth1 = "orth prop 1";
  public $orth2 = "orth prop 2";
}

and then I create two objects:
$a = new foo();

$b = new foo();
$b->dynamic_property = "this is a dynamic property";

Then object $a has only orthodox properties defined by the class but object
$b has an extra dynamic property and must be serialized differently.

Can anyone suggest the best method to distinguish orthodox properties from
dynamic ones? Or at least a way to get a list (HashTable?) of the
properties that belong to a class?


2) HOW DOES ONE DEFINE A CLASS WITH ONE'S PECL EXTENSION?
AMF3 serialization allows for a user-defined serialization technic and the
serialization code is supposed to detect the intention to implement this by
determining whether in object implements the iExternalizable interface (The
idea is similar to __serialize magic method).  I see that certain PHP
modules (e.g., mysqli) define classes in PHP space. Can anyone refer me to
a good extisting example where a class is defined by PECL extension or PHP
core code? Also, how does one determine what interfaces a ZVAL object might
be implementing?

Any help would be truly appreciated.



For anyone who is curious, the AMF3 spec is here:
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/amf/pdf/amf-file-format-spec.pdf

Reply via email to