Updated PHP 5 ToDo

php.internals

(Marcus Börger)

23 years ago
Hello everyone, here is an updated list of things we need to do/discuss before beta 2. High priority: - Completely force a derived class now to implement the same amount of parameters with the same typehints as the inherited one. When it comes to typehints theory allows to provide same or parent types but that would be much harder to implement so only allowing the same type is just easier. We also don't have a way to specify typehints and param amount for functions declared at c-level. Further more we are not able to specify access type of a method declared at c-level (static/public/protected/private/final). - Complete work on exceptions and find a solution on when to throw exceptions and when to use errors. I still do not see any BC problems with making try/catch blocks to convert E_WARING, E_NOTICE & E_ERROR to exceptions (assumed the problemntaic E_ERRORS are changed to E_CORE or such). Why no BC? Simply becuase using try/catch with old libs and relying on error capturing is an antilogy in itself. Especially when thinking about the very limited capabilities in handling errors the old way. Add an opcode to be able to see whether a try/catch is active. This could possibly also allow to check which exceptions will get catched. Having this we could finally convert uncaught exceptions to errors. Discuss about adding 'thorws' to a method declaration and a flag for c-level functions so that the compiler can emit an error when such a method is used without try/catch. - Discuss the package proposal and whether we want it or not. We saw that namespaces didn't really fit in our needs and that they are very problematic. To tell the truth some here are sure they can't be implemented correct at all. The ones thinking they could be done obviosly had another idea of them. So let us not make the same mistake again and instead make sure we are all talking about the same thing in the same language. - Add a third shutdown phase which can be used by extensions like ext/session to do work that must be done before objects and globals get destroyed. Also ensure that variable destrcution is done in two steps first all objects then the globals because an object may rely on a global var (yes ppl will do so). - Plug some memleaks. Easy (patch ready): - Array and resource type hinting (patch at least for arrays is ready and resources can easily be affed). - Include SPL forach hooking into the engine. Renaming the files to 'Zend_whatever' doesn't really make a difference. Maybe the patch is a bit lengthy but the biggest part of it is a function that allows to very effectively call methods - pretty much faster then the current solution. So it would also speed up other things. More things to do: - Include SPL array hooking into the engine (?!?) The current array hooking implementation doesn't allow user defined objects to hook into array overloading with methods like the flexible solutions spl provides. Do we still want this a language feature or as a non default option provided via an extension? Maybe the the cleanest way would be to directly hook into the engine's array overloading facilities and check whether a certain interface is implemented and then call the methods of that interface instead of using the default implementation. - Array overloading misses support for 'unset($obj[$idx]);' - Typehinting with '= NULL' to allow NULL values as discussed - Typehinting for return values? This may be useful especially when working with interfaces. - Most parts of the language are case insensitive, however some parts are not. For instance __construct, __clone,... - Move snprintf.c/spprintf.c into the engine. - Fix static class members. If they are public they need to be accessible from outside the class. If they have an initial value this value should be used and the keyword var should be working as well. php -r 'class t { static public $p = "x";}; $t = new t; var_dump($t->p);' php -r 'class t { static var $p = "x";}; $t = new t; var_dump($t->p);' php -r 'class t { static public $p = "x";}; echo $t::p;' To make this clear: $t->p would add a dynamic propery to instance t while we want to access the static property p which can only be achieved by a different notation which should be <class>'::'<static_member>. - Add support for 'this::<method>()', 'this::<property>' and 'new this()' inside static methods. - Add __sleep(), __wakeup() as object handlers. Best regards, Marcus mailto:marcus.boerger@post.rwth-aachen.de

Jani Taskinen

23 years ago
You forgot these: http://bugs.php.net/search.php?search_for=&boolean=0&limit=All&order_by=id&direction=DESC&cmd=display&status=Open&php_os=&phpver=5&assign=&author_email=&bug_age=0 --Jani On Sun, 20 Jul 2003, Marcus Bö rger wrote:
>Hello everyone, > >here is an updated list of things we need to do/discuss before beta 2. > > >High priority: > >- Completely force a derived class now to implement the same amount of > parameters with the same typehints as the inherited one. When it comes > to typehints theory allows to provide same or parent types but that would > be much harder to implement so only allowing the same type is just easier. > > We also don't have a way to specify typehints and param amount for functions > declared at c-level. Further more we are not able to specify access type of > a method declared at c-level (static/public/protected/private/final). > >- Complete work on exceptions and find a solution on when to throw exceptions > and when to use errors. > > I still do not see any BC problems with making try/catch blocks to convert > E_WARING, E_NOTICE & E_ERROR to exceptions (assumed the problemntaic E_ERRORS > are changed to E_CORE or such). Why no BC? Simply becuase using try/catch > with old libs and relying on error capturing is an antilogy in itself. > Especially when thinking about the very limited capabilities in handling > errors the old way. > > Add an opcode to be able to see whether a try/catch is active. This could > possibly also allow to check which exceptions will get catched. Having this > we could finally convert uncaught exceptions to errors. > > Discuss about adding 'thorws' to a method declaration and a flag for c-level > functions so that the compiler can emit an error when such a method is used > without try/catch. > >- Discuss the package proposal and whether we want it or not. We saw that > namespaces didn't really fit in our needs and that they are very problematic. > To tell the truth some here are sure they can't be implemented correct at > all. The ones thinking they could be done obviosly had another idea of them. > So let us not make the same mistake again and instead make sure we are all > talking about the same thing in the same language. > >- Add a third shutdown phase which can be used by extensions like ext/session > to do work that must be done before objects and globals get destroyed. Also > ensure that variable destrcution is done in two steps first all objects then > the globals because an object may rely on a global var (yes ppl will do so). > >- Plug some memleaks. > > > > >Easy (patch ready): > >- Array and resource type hinting (patch at least for arrays is ready > and resources can easily be affed). > >- Include SPL forach hooking into the engine. > Renaming the files to 'Zend_whatever' doesn't really make a difference. > Maybe the patch is a bit lengthy but the biggest part of it is a function > that allows to very effectively call methods - pretty much faster then the > current solution. So it would also speed up other things. > > > > >More things to do: > >- Include SPL array hooking into the engine (?!?) > > The current array hooking implementation doesn't allow user defined objects > to hook into array overloading with methods like the flexible solutions spl > provides. Do we still want this a language feature or as a non default option > provided via an extension? > > Maybe the the cleanest way would be to directly hook into the engine's array > overloading facilities and check whether a certain interface is implemented > and then call the methods of that interface instead of using the default > implementation. > >- Array overloading misses support for 'unset($obj[$idx]);' > >- Typehinting with '= NULL' to allow NULL values as discussed > >- Typehinting for return values? This may be useful especially when working > with interfaces. > >- Most parts of the language are case insensitive, however some parts are > not. For instance __construct, __clone,... > >- Move snprintf.c/spprintf.c into the engine. > >- Fix static class members. If they are public they need to be accessible from > outside the class. If they have an initial value this value should be used > and the keyword var should be working as well. > php -r 'class t { static public $p = "x";}; $t = new t; var_dump($t->p);' > php -r 'class t { static var $p = "x";}; $t = new t; var_dump($t->p);' > php -r 'class t { static public $p = "x";}; echo $t::p;' > To make this clear: $t->p would add a dynamic propery to instance t while we > want to access the static property p which can only be achieved by a > different notation which should be <class>'::'<static_member>. > >- Add support for 'this::<method>()', 'this::<property>' and 'new this()' > inside static methods. > >- Add __sleep(), __wakeup() as object handlers. > > > >Best regards, > Marcus mailto:marcus.boerger@post.rwth-aachen.de > > >
-- https://www.paypal.com/xclick/business=sniper@php.net&no_note=1&tax=0&currency_code=EUR

George Schlossnagle

23 years ago
On Sunday, July 20, 2003, at 09:44 AM, Marcus BXrger wrote:
> Hello everyone, > > here is an updated list of things we need to do/discuss before beta 2. > > > High priority: > > - Completely force a derived class now to implement the same amount of > parameters with the same typehints as the inherited one. When it > comes > to typehints theory allows to provide same or parent types but that > would > be much harder to implement so only allowing the same type is just > easier. > > We also don't have a way to specify typehints and param amount for > functions > declared at c-level. Further more we are not able to specify access > type of > a method declared at c-level (static/public/protected/private/final).
Are you talking about just interface implementation here, or general inheritance. If the latter, I'm not a big fan of this.
> > - Complete work on exceptions and find a solution on when to throw > exceptions > and when to use errors. > > I still do not see any BC problems with making try/catch blocks to > convert > E_WARING, E_NOTICE & E_ERROR to exceptions (assumed the problemntaic > E_ERRORS > are changed to E_CORE or such). Why no BC? Simply becuase using > try/catch > with old libs and relying on error capturing is an antilogy in > itself. > Especially when thinking about the very limited capabilities in > handling > errors the old way.
As you know, I'm a big fan of this in th case of E_ERROR, because there really are no BC issues involved. The E_WARNING and E_NOTICE errors are different though, and seem like a serious concern to me. This has been gone over a number of times, but the example that worries me is try { new_func(); } catch (Exception $e) {} function new_func() { /* .... do some stuff ...*/ old_func(); /* ... more stuff ... */ } old_func() has been coded to throw warnings for non critical issues (as informational messages). Broken. E_NOTICE is even worse, since many folks code does not run clean under E_NOTICE. Now you include a file in your try block somewhere and you get an exception. Seems icky.
> Discuss about adding 'thorws' to a method declaration and a flag for > c-level > functions so that the compiler can emit an error when such a method > is used > without try/catch.
Huh? Shouldn't it be my choice to put a try/catch block around a function? Why should I be forced to catch ay errors it emits?

(Marcus Börger)

23 years ago
Hello George, Sunday, July 20, 2003, 5:30:43 PM, you wrote:
>> - Completely force a derived class now to implement the same amount of >> parameters with the same typehints as the inherited one. When it comes >> to typehints theory allows to provide same or parent types but that would >> be much harder to implement so only allowing the same type is just easier. >> >> We also don't have a way to specify typehints and param amount for functions >> declared at c-level. Further more we are not able to specify access type of >> a method declared at c-level (static/public/protected/private/final).
GS> Are you talking about just interface implementation here, or general GS> inheritance. If the latter, I'm not a big fan of this. To be type correct we would need it also in general inheritance. But for the moment i think it is somewhat important to give interfaces a sense at all. So i can live with interfaces only pretty well.
>> >> - Complete work on exceptions and find a solution on when to throw exceptions >> and when to use errors. >> >> I still do not see any BC problems with making try/catch blocks to convert >> E_WARING, E_NOTICE & E_ERROR to exceptions (assumed the problemntaic E_ERRORS >> are changed to E_CORE or such). Why no BC? Simply becuase using try/catch >> with old libs and relying on error capturing is an antilogy in itself. >> Especially when thinking about the very limited capabilities in handling >> errors the old way.
GS> As you know, I'm a big fan of this in th case of E_ERROR, because there GS> really are no BC issues involved. The E_WARNING and E_NOTICE errors GS> are different though, and seem like a serious concern to me. This has GS> been gone over a number of times, but the example that worries me is GS> try { GS> new_func(); GS> } GS> catch (Exception $e) {} GS> function new_func() { GS> /* .... do some stuff ...*/ GS> old_func(); GS> /* ... more stuff ... */ GS> } GS> old_func() has been coded to throw warnings for non critical issues (as GS> informational messages). Broken. GS> E_NOTICE is even worse, since many folks code does not run clean under GS> E_NOTICE. Now you include a file in your try block somewhere and you GS> get an exception. GS> Seems icky. As i said combining both thechniques makes no sense and converting the error mechanisms of old code when preparing new things shouldn't be a problem at all since you have to change several things already without the exception issue.
>> Discuss about adding 'thorws' to a method declaration and a flag for c-level >> functions so that the compiler can emit an error when such a method is used >> without try/catch.
GS> Huh? Shouldn't it be my choice to put a try/catch block around a GS> function? Why should I be forced to catch ay errors it emits? For the moment it's only an idea. And i don't know if it is a good one :-) Best regards, Marcus mailto:helly@php.net

George Schlossnagle

23 years ago
On Sunday, July 20, 2003, at 11:45 AM, Marcus BXrger wrote:
> As i said combining both thechniques makes no sense and converting the > error > mechanisms of old code when preparing new things shouldn't be a > problem at all > since you have to change several things already without the exception > issue.
I don't know if I buy this. If you have a couple hundred thousand lines of php4 code, auditing it for E_NOTICEs can be quite an imposing task. This is a much larger porting effort than is currently required (except possibly that classes must now be declared before they are used -- shiver.)

(Marcus Börger)

23 years ago
Hello George, Sunday, July 20, 2003, 5:50:52 PM, you wrote: GS> On Sunday, July 20, 2003, at 11:45 AM, Marcus BXrger wrote:
>> As i said combining both thechniques makes no sense and converting the >> error >> mechanisms of old code when preparing new things shouldn't be a >> problem at all >> since you have to change several things already without the exception >> issue.
GS> I don't know if I buy this. If you have a couple hundred thousand GS> lines of php4 code, auditing it for E_NOTICEs can be quite an imposing GS> task. This is a much larger porting effort than is currently required GS> (except possibly that classes must now be declared before they are used GS> -- shiver.) You missed the references.... We could disable conversion from errors to exceptions in the BC mode and all is fine.
-- Best regards, Marcus mailto:helly@php.net

Timm Friebe

23 years ago
On Sun, 2003-07-20 at 15:44, Marcus Börger wrote:
> Hello everyone, > > here is an updated list of things we need to do/discuss before beta 2.
+ Finalize and fix the Reflection API by applying this patch: http://sitten-polizei.de/php/reflection_api/zend_reflection_api.c.diff For details, have a look at http://sitten-polizei.de/php/reflection_api/, especially the ChangeLog. - Timm

George Schlossnagle

23 years ago
On Sunday, July 20, 2003, at 11:33 AM, Timm Friebe wrote:
> On Sun, 2003-07-20 at 15:44, Marcus Börger wrote: >> Hello everyone, >> >> here is an updated list of things we need to do/discuss before beta 2. > > + Finalize and fix the Reflection API by applying this patch: > http://sitten-polizei.de/php/reflection_api/zend_reflection_api.c.diff
Done. George

Zeev Suraski

23 years ago
At 16:44 20/07/2003, Marcus Börger wrote:
>Hello everyone, > >here is an updated list of things we need to do/discuss before beta 2.
I think we can live with many of these remaining until after beta 2. As long as we fix plenty of things (which we have), I think we should try to aim for another beta within 2 or 3 weeks.
>High priority: > >- Completely force a derived class now to implement the same amount of > parameters with the same typehints as the inherited one. When it comes > to typehints theory allows to provide same or parent types but that would > be much harder to implement so only allowing the same type is just easier.
That should be happening today already.
> We also don't have a way to specify typehints and param amount for > functions > declared at c-level. Further more we are not able to specify access type of > a method declared at c-level (static/public/protected/private/final).
We'll add APIs for that.
>- Complete work on exceptions and find a solution on when to throw exceptions > and when to use errors. > > I still do not see any BC problems with making try/catch blocks to convert > E_WARING, E_NOTICE & E_ERROR to exceptions (assumed the problemntaic > E_ERRORS > are changed to E_CORE or such). Why no BC? Simply becuase using try/catch > with old libs and relying on error capturing is an antilogy in itself. > Especially when thinking about the very limited capabilities in handling > errors the old way. > > Add an opcode to be able to see whether a try/catch is active. This could > possibly also allow to check which exceptions will get catched. Having > this > we could finally convert uncaught exceptions to errors.
As I mentioned before, I don't really see a good solution here (for anything other than E_ERROR, at least). Since I don't think there's a solution in existence, it's low priority in my book (as in, I can live with seeing this remaining the way it is now).
> Discuss about adding 'thorws' to a method declaration and a flag for > c-level > functions so that the compiler can emit an error when such a method is > used > without try/catch.
*sigh*
>- Discuss the package proposal and whether we want it or not. We saw that > namespaces didn't really fit in our needs and that they are very > problematic. > To tell the truth some here are sure they can't be implemented correct at > all. The ones thinking they could be done obviosly had another idea of > them. > So let us not make the same mistake again and instead make sure we are all > talking about the same thing in the same language.
Low priority in my book for similar reasons.
>- Add a third shutdown phase which can be used by extensions like ext/session > to do work that must be done before objects and globals get destroyed. Also > ensure that variable destrcution is done in two steps first all objects > then > the globals because an object may rely on a global var (yes ppl will do > so).
We need to look into it - if it's doable, we'll do it.
>- Include SPL forach hooking into the engine. > Renaming the files to 'Zend_whatever' doesn't really make a difference. > Maybe the patch is a bit lengthy but the biggest part of it is a function > that allows to very effectively call methods - pretty much faster then the > current solution. So it would also speed up other things.
I don't see any reason for it to be longer than a hundred or two hundred lines of code - from the last time I saw it - it needs to be seriously cleaned up and written with the knowledge that it's going to be integrated in the engine before we integrate it.
>- Include SPL array hooking into the engine (?!?)
I don't think we need this any longer, we have a very complete and clean solution now with the get/set dim hooks.
>- Fix static class members. If they are public they need to be accessible from > outside the class. If they have an initial value this value should be used > and the keyword var should be working as well. > php -r 'class t { static public $p = "x";}; $t = new t; var_dump($t->p);' > php -r 'class t { static var $p = "x";}; $t = new t; var_dump($t->p);' > php -r 'class t { static public $p = "x";}; echo $t::p;' > To make this clear: $t->p would add a dynamic propery to instance t > while we > want to access the static property p which can only be achieved by a > different notation which should be <class>'::'<static_member>.
There's no need for the keyword 'var' to work - it's deprecated, and shouldn't be supported for new syntax. I don't see a good reason to have the -> notation work with static elements. Differentiating between the two families (dynamic / static elements) at the syntax level makes good sense.
>- Add support for 'this::<method>()', 'this::<property>'
? That's what you have self:: for.
> and 'new this()' > inside static methods.
I see no compelling reason to add 'new this()', but either way, if we do find such a reason, it will be 'new self()'. Zeev

(Marcus Börger)

23 years ago
Hello Zeev, Sunday, July 20, 2003, 8:09:31 PM, you wrote:
>>- Add support for 'this::<method>()', 'this::<property>'
ZS> ? ZS> That's what you have self:: for.
>> and 'new this()' >> inside static methods.
ZS> I see no compelling reason to add 'new this()', but either way, if we do ZS> find such a reason, it will be 'new self()'. Timm already ran into the problem also self and this are of course different things and their meaning should not be changed that would be to much confusion.
-- Best regards, Marcus mailto:helly@php.net

Andi Gutmans

23 years ago
At 08:20 PM 20/7/2003 +0200, Marcus Börger wrote:
>Hello Zeev, > >Sunday, July 20, 2003, 8:09:31 PM, you wrote: > > >>- Add support for 'this::<method>()', 'this::<property>' > >ZS> ? >ZS> That's what you have self:: for. > > >> and 'new this()' > >> inside static methods. > >ZS> I see no compelling reason to add 'new this()', but either way, if we do >ZS> find such a reason, it will be 'new self()'. > >Timm already ran into the problem also self and this are of course different >things and their meaning should not be changed that would be to much >confusion.
But you don't have $this in a static function... self refers to the class and thus new self() makes more sense. Andi

(Marcus Börger)

23 years ago
Hello Andi, Sunday, July 20, 2003, 9:29:56 PM, you wrote: AG> At 08:20 PM 20/7/2003 +0200, Marcus Börger wrote:
>>Hello Zeev, >> >>Sunday, July 20, 2003, 8:09:31 PM, you wrote: >> >> >>- Add support for 'this::<method>()', 'this::<property>' >> >>ZS> ? >>ZS> That's what you have self:: for. >> >> >> and 'new this()' >> >> inside static methods. >> >>ZS> I see no compelling reason to add 'new this()', but either way, if we do >>ZS> find such a reason, it will be 'new self()'. >> >>Timm already ran into the problem also self and this are of course different >>things and their meaning should not be changed that would be to much >>confusion.
AG> But you don't have $this in a static function... self refers to the class AG> and thus new self() makes more sense. The problem was with derived classes and inherited (static) factory methods. There you needed 'this' (*whithout $*) instead of 'self'.
-- Best regards, Marcus mailto:helly@php.net

(Marcus Börger)

23 years ago
Hello Zeev, Sunday, July 20, 2003, 8:09:31 PM, you wrote:
>>- Complete work on exceptions and find a solution on when to throw exceptions >> and when to use errors. >> >> I still do not see any BC problems with making try/catch blocks to convert >> E_WARING, E_NOTICE & E_ERROR to exceptions (assumed the problemntaic E_ERRORS >> are changed to E_CORE or such). Why no BC? Simply becuase using try/catch >> with old libs and relying on error capturing is an antilogy in itself. >> Especially when thinking about the very limited capabilities in handling >> errors the old way. >> >> Add an opcode to be able to see whether a try/catch is active. This could >> possibly also allow to check which exceptions will get catched. Having this >> we could finally convert uncaught exceptions to errors.
ZS> As I mentioned before, I don't really see a good solution here (for ZS> anything other than E_ERROR, at least). Since I don't think there's a ZS> solution in existence, it's low priority in my book (as in, I can live with ZS> seeing this remaining the way it is now). Probably we do autoconversion for E_ERROR then only for now. Collect some expirience with it and later *maybe* add the other types?
-- Best regards, Marcus mailto:helly@php.net

(Marcus Börger)

23 years ago
Hello Zeev, Sunday, July 20, 2003, 8:09:31 PM, you wrote:
>>- Include SPL forach hooking into the engine. >> Renaming the files to 'Zend_whatever' doesn't really make a difference. >> Maybe the patch is a bit lengthy but the biggest part of it is a function >> that allows to very effectively call methods - pretty much faster then the >> current solution. So it would also speed up other things.
ZS> I don't see any reason for it to be longer than a hundred or two hundred ZS> lines of code - from the last time I saw it - it needs to be seriously ZS> cleaned up and written with the knowledge that it's going to be integrated ZS> in the engine before we integrate it. Perhaps adding my method handler is a good thing to do first. Use it for all places where appropriate already (good speedup). And then i could make up a new cleaner foreach patch which should also be much shorter then.
-- Best regards, Marcus mailto:helly@php.net

Zeev Suraski

23 years ago
At 21:20 20/07/2003, Marcus Börger wrote:
>Hello Zeev, > >Sunday, July 20, 2003, 8:09:31 PM, you wrote: > > >>- Add support for 'this::<method>()', 'this::<property>' > >ZS> ? >ZS> That's what you have self:: for. > > >> and 'new this()' > >> inside static methods. > >ZS> I see no compelling reason to add 'new this()', but either way, if we do >ZS> find such a reason, it will be 'new self()'. > >Timm already ran into the problem also self and this are of course different >things and their meaning should not be changed that would be to much >confusion.
Right, and self() is the right choice here (you're referring to the class, not to a particular instance). But that's *if* we decide that we need that kind of syntax in the first place, I'm for one am not convinced... Zeev

Philip Olson

23 years ago
On Sun, 20 Jul 2003, Marcus B?rger wrote:
> Hello everyone, > > here is an updated list of things we need to do/discuss before beta 2.
[snip] And here's one more: - Rename various DLL's as PHP5 and not PHP4. Example, have php5apache.dll instead of php4apache.dll for PHP 5. Regards, Philip

Olivier Hill

23 years ago
Philip Olson wrote:
> And here's one more: > > - Rename various DLL's as PHP5 and not PHP4. Example, have > php5apache.dll instead of php4apache.dll for PHP 5. > > Regards, > Philip
I've submitted a patch (tar file) containing various new .dsp/.dsw fixing all those kind of things... Never got a reply. Oliver

Derick Rethans

23 years ago
On Mon, 21 Jul 2003, Olivier Hill wrote:
> I've submitted a patch (tar file) containing various new .dsp/.dsw > fixing all those kind of things... > > Never got a reply.
AFAIK you were asked to send a patch instead... and not totally new files. regards, Derick
-- "Interpreting what the GPL actually means is a job best left to those that read the future by examining animal entrails." ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ International PHP Magazine http://php-mag.net/ -------------------------------------------------------------------------

Olivier Hill

23 years ago
Derick Rethans wrote:
> AFAIK you were asked to send a patch instead... and not totally new > files.
http://sheep.deev.com/~olivier/patch.txt I won't send it here (375KB), but this is the unified diff between two source dirs. This time, please inform me if the format is not valid. Some files are created in the process (to take the new php5* name). Oliver