I have had a similar idea.  I also tried the custom error handler
aproach and it didn't work here either.  I have set the project aside
that I was thinking about it for but I do have some ideas that would
help and may be able to contribute.  I wasn't even able to get php to
call my custom error handler for function not found errors.  How did you
do that?  Was there anything useful in the context argument?  My guess
is that to get this aproach to work would require hacking the code to
php itself but the hack wouldn't be very major.  However I do have an
alternate plan that has been waiting for me to get around to building it
is a simple parser that will read a php file and get the required
functions and classes and then pre build a library file for just that
page.  The parsing shouldn't be that dificult as all function calls
begin with 'func(' and for classes checking for 'new classname' or
'classname::' would give me a list of all items that need to be checked
for.  Then simply build (from the source) a list of all builtin php
functions and allow those and check for declarations of inline functions
and classes while parsing and remove those.  That would leave a list of
functions and classes that are external.  Then build a database of
classes and functions either as a real database or simple an index of
the files that contain each resource.  I don't think it would be too
hard.  The next step would be to make a publicly available archive of
functions and classes that fit into this index.  Or to build it into
pear.

Please keep in touch with me on this issue.  Feel free to email me off
list if you want.

Eric

On Wed, 3 Apr 2002, Arpad Tamas wrote:

> Hi Everyone!
>
> I have an idea, but I don't know how to realise it, if it can be at
> all.
> We have a relatively big system, with 52k lines of php code without
> much html, and many classes (1138) that depend on each other.
> And I think I don't need to say that php parses the code somewhat
> slow. That's what I'm trying to solve. I know there are code caches,
> but none of them suits all of our customers or our needs (price,
> effectiveness).
> Of course not all classes are needed on every page request, so I'm
> trying to separate them, and require them when they are really
> needed, but that's not easy with 1100 classes.
>
> So I thought I'd write a custom error handler, and when an unloaded
> class is created or it's static method is accessed an error would
> be triggered and I'd require it in the error handler. The "only"
> problem is, that after the error handler finished the main code is
> executed *after* the "statement" that triggered the error, so I can't
> tell php to give one more try for the previously faulty code.
>
> Is there any chance for this to work with some trick, or do you know
> of a better sollution for the problem?
>
> Thanks for your help,
>
>       Arpi
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to