[PHP-DEV] [PATCH] [ZE] More useful error message for class redeclaration [final version]

2002-09-29 Thread Wez Furlong
And here is the final version of my class redeclaration patch. class Foo {} class Foo {} -> Fatal error: Cannot redeclare class foo (previously declared in /home/wez/source/php/PHPDEV/wez.declare.class.php:3) in /home/wez/source/php/PHPDEV/wez.declare.class.php on line 5 class Directory {} -

Re: [PHP-DEV] [PATCH] [ZE] More useful error message for class redeclaration

2002-09-23 Thread Andi Gutmans
If the zend_hash_add() fails then you can do a zend_hash_find() to retreive the class which is in the hash and print its information. If its information is NULL (we have to make sure we init it) then you can print out a message that it's an internal class. Does that make sense? Andi At 06:26

Re: [PHP-DEV] [PATCH] [ZE] More useful error message for class redeclaration

2002-09-23 Thread Wez Furlong
The problem is (as I understand it!) that the ZEND_DECLARE_CLASS case in do_bind_function_or_class retrieves the class entry for the user-defined class and not the internal class, and that is why the message reflects the user class. I can't really see why this is the case, but then I haven't rea

Re: [PHP-DEV] [PATCH] [ZE] More useful error message for class redeclaration

2002-09-23 Thread Andi Gutmans
Can't you make sure that the filename of internal classes will be NULL and then we can check for it and say it's an internal class? Andi At 03:59 PM 9/23/2002 +0100, Wez Furlong wrote: >X-Managedo-partname: name="1.1"; mimetype="text/plain" >Content-Type: text/plain; charset="iso-8859-1" >Conte

[PHP-DEV] [PATCH] [ZE] More useful error message for class redeclaration

2002-09-23 Thread Wez Furlong
I'm resubmitting this little patch for the ZE; when presented with code like this: The engine will generate an error message like this: Cannot redeclare class Foo (previously declared in file.php:2) Caveat Emptor: if someone tries to redeclare an internal/builtin class such as Directory, the