Hello,
Got a few questions if anybody can help me out:
- what's the difference between zend_object and zend_object_value? what is each for? Because i'm confused..
- What are zend_object_store_bucket; and zend_object_store used for?
Thanks,
A.
Hello,
Got a few questions if anybody can help me out:
- what's the difference between zend_object and zend_object_value? what
is each for? Because i'm confused..- What are zend_object_store_bucket; and zend_object_store used for?
Thanks,
A.
A zend_object_value is what is saved in the zval. It has an object handle
(an integer uniquely identifying the object) and a structure with object
handlers (which are used whenever you interact with the object). The object
handle can be used to get the object data from the object_store. The
object_store is basically a dynamic array of zend_object_store_buckets. The
buckets contain the object data, as well as handlers for dtor/free/clone
and some other stuff. The default object structure stored in the object
store is a zend_object. It contains the class entry, properties and
recursion guards. It is also possible to put a custom object structure into
the store, but even in that case zend_object will be the first part of the
structure.
Nikita
Hi!
- what's the difference between zend_object and zend_object_value? what is each for? Because i'm confused..
- What are zend_object_store_bucket; and zend_object_store used for?
It may be easier to look at it this way:
For the engine, the object is an abstraction, which has an ID and a set
of handlers (see zend_object_handlers structure). That's how the engine
talks to the objects. That's what zend_object_value is.
These objects can be, in theory, anything. In practice, all user-space
objects (as opposed to objects that may be created by the engine) are
something that we can call "standard Zend engine objects". These objects
are created from Zend Engine classes, have properties, etc. - that's
what zend_object stores. These objects are kept in the "object store"
and each time you create one it gets stored there and receives a store
ID. That's the ID the rest of the engine (see above) uses to talk to the
object. Note that custom objects (not standard ones) also can be kept in
the store, but do not have to be. Keeping them in the store saves some
work though - because you'd have to keep them somewhere anyway...
zend_object_store_bucket is just a data structure used in the
maintenance of the store - it contains the actual object data and some
service values that are needed to efficiently manage store memory.
You may also check out Zend/OBJECTS2_HOWTO file in PHP source - it has
some more details.
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227