Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56640 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70342 invoked from network); 26 Nov 2011 01:47:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2011 01:47:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=cpriest@zerocue.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cpriest@zerocue.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zerocue.com designates 74.115.204.40 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 74.115.204.40 relay-hub204.domainlocalhost.com Received: from [74.115.204.40] ([74.115.204.40:5939] helo=relay-hub204.domainlocalhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 88/74-47501-52540DE4 for ; Fri, 25 Nov 2011 20:47:19 -0500 Received: from MBX201.domain.local ([169.254.1.105]) by HUB204.domain.local ([74.115.204.40]) with mapi id 14.01.0289.001; Fri, 25 Nov 2011 20:47:15 -0500 To: "internals@lists.php.net" Thread-Topic: Inject code within Compiler? Thread-Index: Acyr3P9QNOvDiMHuS4SLIJBoZlxeJw== Date: Sat, 26 Nov 2011 01:47:14 +0000 Message-ID: <9570D903A3BECE4092E924C2985CE4853993ED98@MBX201.domain.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.64.24] Content-Type: multipart/alternative; boundary="_000_9570D903A3BECE4092E924C2985CE4853993ED98MBX201domainloc_" MIME-Version: 1.0 Subject: Inject code within Compiler? From: cpriest@zerocue.com (Clint M Priest) --_000_9570D903A3BECE4092E924C2985CE4853993ED98MBX201domainloc_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Trying implement empty getter/setter syntax such as: public $Hours { get; set; } Is there any way to "inject" code into the compile process? I'm trying via (just some proof of concept code, ignore the buffer overrun = potential) char injected_code[1024] = =3D ""; sprintf((char*)&injected_co= de, "{ return $this->%s; }", Z_STRVAL(var_name->u.constant)); znode *injected_node =3D em= alloc(sizeof(znode)); Z_STRVAL(injected_node->u.c= onstant) =3D (char*)&injected_code; Z_STRLEN(injected_node->u.c= onstant) =3D strlen(injected_code); zend_do_abstract_method(fun= ction_token, modifiers, injected_node TSRMLS_CC); However this is causing a segfault, I'm assuming this is because I'm not in= itializing something of the znode properly. How can I do this? Thanks, -Clint --_000_9570D903A3BECE4092E924C2985CE4853993ED98MBX201domainloc_--