Hey, looks okay (and it works too :). Only one little thing:
+ if (CG(class_entry).def_file) + CG(class_entry).def_file = estrdup(CG(class_entry).def_file); Should really be: + if (CG(class_entry).def_file) { + CG(class_entry).def_file = estrdup(CG(class_entry).def_file); + } regards, Derick On Wed, 18 Sep 2002, Wez Furlong wrote: > OK, so here's a little patch that does just that: > I've inlined it and attached it, just in case it gets mangled > somewhere along the way... > > --Wez. > > Index: zend.h > =================================================================== > RCS file: /repository/Zend/zend.h,v > retrieving revision 1.160 > diff -u -r1.160 zend.h > --- zend.h 17 Sep 2002 09:06:07 -0000 1.160 > +++ zend.h 18 Sep 2002 10:34:05 -0000 > @@ -275,6 +275,10 @@ > void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, >zend_property_reference *property_reference); > zval (*handle_property_get)(zend_property_reference *property_reference); > int (*handle_property_set)(zend_property_reference *property_reference, zval >*value); > + > + /* location of definition of this class */ > + char *def_file; > + int def_lineno; > }; > > > Index: zend_compile.c > =================================================================== > RCS file: /repository/Zend/zend_compile.c,v > retrieving revision 1.236 > diff -u -r1.236 zend_compile.c > --- zend_compile.c 20 Aug 2002 14:26:31 -0000 1.236 > +++ zend_compile.c 18 Sep 2002 10:34:07 -0000 > @@ -1190,7 +1190,10 @@ > if (zend_hash_add(class_table, >opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, ce, >sizeof(zend_class_entry), NULL)==FAILURE) { > (*ce->refcount)--; > if (!compile_time) { > - zend_error(E_ERROR, "Cannot >redeclare class %s", opline->op2.u.constant.value.str.val); > + zend_error(E_ERROR, "Cannot >redeclare class %s (previously declared in %s:%d)", > + >opline->op2.u.constant.value.str.val, > + ce->def_file ? >cd->def_file : "Unknown", > + ce->def_lineno); > } > return FAILURE; > } else { > @@ -1581,6 +1584,11 @@ > CG(class_entry).handle_property_set = NULL; > CG(class_entry).handle_property_get = NULL; > > + CG(class_entry).def_file = zend_get_compiled_filename(TSRMLS_C); > + if (CG(class_entry).def_file) > + CG(class_entry).def_file = estrdup(CG(class_entry).def_file); > + CG(class_entry).def_lineno = CG(zend_lineno); > + > /* code for inheritance from parent class */ > if (parent_class_name) { > zend_class_entry *parent_class; > > > On 09/18/02, "Zeev Suraski" <[EMAIL PROTECTED]> wrote: > > Yep > > > > At 07:45 18/09/2002, Wez Furlong wrote: > > >PHP doesn't print a very helpful error message about the redefinition > > >of class Foo, particularly when the class was defined in a separate file. > > >The feature request is to have the error message to include the file/line > > >of the first definition to help in tracking down problems. > > > > > >Is implementing this as simple as adding file/line members to zend_class_entry > > >when the class is parsed/compiled and spitting them out when a redefinition > > >error occurs? > > > > --------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ JDI Media Solutions -----------------------------[ [EMAIL PROTECTED]: Databases are for Assholes ]- -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php