Actually, this will work! In the "class_name_reference" rule, the
"zend_do_fetch_class" function is called. Inside this function, class_name
is a znode, and what is assigned to the opcode is "opline->op2 =
*class_name". This function is changed to check the import hashtable, and if
a match is found, then the znode string value is updated to contain the full
class name! Here's some pseudocode:

<?php
include('Object.php');
// include opcode is generated here

import lang:Object;
// "Object" => "lang:Object" added to import hashtable

$o = new Object();
// zend_do_fetch_class checks for "Object" in the import hashtable.
// A match is found, so "class_name->u.constant.value.str" is modified from
"Object" to "lang:Object".
// At runtime, the lang:Object class will be created and added to
class_table,
// and since all opcodes are using lang:Object instead of simply Object,
then everything will work.
?>


--
Jessie


""Timm Friebe"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> [...]
> > - All imports are done at compile time.
>
> So:
>
> == Object.php ==
> <?php
>   package lang { class Object {
>
>   }}
> ?>
>
> == script.php ==
> <?php
>   include('Object.php');
>
>   import lang:Object;
> ?>
>
> ...will not work. You'll need an opcode for this.
>
> - Timm

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to