Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12973 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79769 invoked by uid 1010); 25 Sep 2004 02:03:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 79732 invoked from network); 25 Sep 2004 02:03:52 -0000 Received: from unknown (HELO bobsilva.com) (198.237.84.92) by pb1.pair.com with SMTP; 25 Sep 2004 02:03:52 -0000 Received: from [198.237.84.90] (account me HELO salty) by bobsilva.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 439261 for internals@lists.php.net; Fri, 24 Sep 2004 18:45:19 -0700 To: Date: Fri, 24 Sep 2004 19:02:10 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Thread-Index: AcSio6rI0e8u0g/ARlavgTC6q7e6xA== Message-ID: Subject: Ideas on hooking into the object cast handler From: junkmail@bobsilva.com ("Robert Silva") I'm working on creating object wrappers for native php types. With ZE2 and the cast_object object handler, I am able to "unbox" the objects to their native php types with simple casts, but as ZE2 currently stands, (to my knowledge at least) there is no way to hook into the (object)native_type cast. Currently, when you cast a native value to an object using (object)$native_val, it calls convert_to_object which simply converts the native type to an array. I was hoping some of you more familiar with the ZE than I had some ideas of how it may be modified to allow an extension to hook into the convert_to_object function. Looked around for some implementation of an extension registering a callback inside the engine but couldn't find any examples. Here is a userland example of what I am trying to accomplish: $intObj = new PInt32(5); // Int object wrapper $phpInt = (int)$intObj; // Calls the cast_object handler for the PInt32 obj This next part isn't currently possible $intObjB = (object)$phpInt; But if I could hook into the convert_to_object function, I could determine what type of class to return based on the op->type being cast. It can be done, just not sure 1) how it would be generic enough (without registering a callback), and 2) whether you guys would be opposed to it, or 3) am I an idiot for trying to do this. Thanks Bob Silva