PHP 6.0 Wishlist

php.internals

Rasmus Lerdorf

21 years ago
Since we are breaking a lot of stuff in 6.0, at least with Unicode_semantics=On I am wondering if it may not be time to break some more stuff and do a bit of spring cleaning. It would mean many apps would need some work to work on PHP 6, but at the same time I think it is work people would welcome since it would mostly involve removing hacks instead of adding them. And yes, I know this is pretty controversial, so take a few deep breaths before replying, please. 1. Remove register_globals completely 2. Remove magic_quotes_* 3. Add input filter extension which will include a mechanism for application developers to very easily turn it off which would swap the raw GPC arrays back in case the site had it turned on by default. 4. Include an opcode cache by default. A lot of work has gone into pecl/apc recently, but I am not hung up on which one goes in. 5. Remove safe_mode and focus on open_basedir 6. Remove some stuff that has been marked deprecated since PHP 3/4 A couple of others that we could consider, but I don't actually think wins us much apart from academic purity (which I have never been all that keen on) are: 7. Make identifiers case-sensitive 8. Remove various function aliases -Rasmus

Derick Rethans

21 years ago
On Fri, 12 Aug 2005, Rasmus Lerdorf wrote:
> Since we are breaking a lot of stuff in 6.0, at least with > Unicode_semantics=On I am wondering if it may not be time to break some > more stuff and do a bit of spring cleaning. It would mean many apps > would need some work to work on PHP 6, but at the same time I think it > is work people would welcome since it would mostly involve removing > hacks instead of adding them. And yes, I know this is pretty > controversial, so take a few deep breaths before replying, please. > > 1. Remove register_globals completely
+1
> 2. Remove magic_quotes_*
+1
> 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default.
+1
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
+1
> 5. Remove safe_mode and focus on open_basedir
+1 (I'd say remove both though ;-)
> 6. Remove some stuff that has been marked deprecated since PHP 3/4
+1
> A couple of others that we could consider, but I don't actually think > wins us much apart from academic purity (which I have never been all > that keen on) are: > > 7. Make identifiers case-sensitive
You mean: make *all* identifiers case-sensitive? (Currently varnames are already case-sensitive). If you meant all: +1
> 8. Remove various function aliases
+1 Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Andrei Zmievski

21 years ago
On Aug 12, 2005, at 10:48 AM, Rasmus Lerdorf wrote:
> 1. Remove register_globals completely
Yes.
> 2. Remove magic_quotes_*
Yes. Nothing but trouble, this one.
> 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by > default.
Yes.
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
Emphatically yes.
> 5. Remove safe_mode and focus on open_basedir
Yes.
> 6. Remove some stuff that has been marked deprecated since PHP 3/4
I don't have an exact list of this, but yes.
> A couple of others that we could consider, but I don't actually think > wins us much apart from academic purity (which I have never been all > that keen on) are: > > 7. Make identifiers case-sensitive
I've already stuck my neck out on this one a couple of times, and haven't gotten much traction, but sure..
> 8. Remove various function aliases
Could be nice to clean up. -Andrei

Ilia A.

21 years ago
Rasmus Lerdorf wrote:
> 1. Remove register_globals completely
+1
> 2. Remove magic_quotes_*
+1
> 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default.
+1 As long as swapping for raw takes no more then a function call per input type, ala restore_input(PHP_GET).
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
+1 As long as it does not prevent alternate solutions from being used.
> 5. Remove safe_mode and focus on open_basedir
+1
> 6. Remove some stuff that has been marked deprecated since PHP 3/4
Let's do this on a case by case basis, perhaps make a list of all deprecated items and vote on them individually.
> 8. Remove various function aliases
That closely relates to 6, so same comments apply. Ilia

Gareth Ardron

21 years ago
Rasmus Lerdorf wrote:
>1. Remove register_globals completely >2. Remove magic_quotes_* >3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default. > >
Yes please :-) That'd remove half my admin headaches from shared boxes.
>4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in. > >
I'm not sure if it should be turned on by default - maybe ini settable. Personally, I've come up against a number of issues with apc & session support and wouldn't really trust developing in an environment with an opcode cache turned on. No real opinion on the rest though. Would make sense for any api changes for modules to be pushed through in the same release though as well, as we're going to have to change our modules for unicode support anyway.

Wez Furlong

21 years ago
I agree on all points. Case sensitivity would be nice IMO, but I can continue to live without it. --Wez. On 8/12/05, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:

George Schlossnagle

21 years ago
On Aug 12, 2005, at 1:48 PM, Rasmus Lerdorf wrote:
> Since we are breaking a lot of stuff in 6.0, at least with > Unicode_semantics=On I am wondering if it may not be time to break > some > more stuff and do a bit of spring cleaning. It would mean many apps > would need some work to work on PHP 6, but at the same time I think it > is work people would welcome since it would mostly involve removing > hacks instead of adding them. And yes, I know this is pretty > controversial, so take a few deep breaths before replying, please. > > 1. Remove register_globals completely
+1
> 2. Remove magic_quotes_*
+1
> 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by > default.
That seems a bit scary, and almost as if it would defeat the purpose. I'm all for an input filter extension, but it should be one that can't be easily neutered by (potentially malicious) applications.
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
+1
> 6. Remove some stuff that has been marked deprecated since PHP 3/4
+1. I agree with Ilia that this should be done on a case-by-case basis.
> A couple of others that we could consider, but I don't actually think > wins us much apart from academic purity (which I have never been all > that keen on) are: > > 7. Make identifiers case-sensitive
+1 9. Radically change all the operator syntaxes. Oh wait, that's Perl 6.0, sorry. George

Derick Rethans

21 years ago
On Fri, 12 Aug 2005, George Schlossnagle wrote:
> > 3. Add input filter extension which will include a mechanism for > > application developers to very easily turn it off which would swap > > the raw GPC arrays back in case the site had it turned on by > > default. > > That seems a bit scary, and almost as if it would defeat the purpose. I'm > all for an input filter extension, but it should be one that can't be easily > neutered by (potentially malicious) applications.
I wrote up the following spec for this extension: http://files.derickrethans.nl/filter_extension.html Derick

George Schlossnagle

21 years ago
On Aug 12, 2005, at 2:19 PM, Derick Rethans wrote:
> On Fri, 12 Aug 2005, George Schlossnagle wrote: > > >>> 3. Add input filter extension which will include a mechanism for >>> application developers to very easily turn it off which would >>> swap >>> the raw GPC arrays back in case the site had it turned on by >>> default. >>> >> >> That seems a bit scary, and almost as if it would defeat the >> purpose. I'm >> all for an input filter extension, but it should be one that can't >> be easily >> neutered by (potentially malicious) applications. >> > I wrote up the following spec for this extension: > http://files.derickrethans.nl/filter_extension.html
Where's the part about an application swapping back for the raw arrays (as opposed to accessing them specifically as _RAW_GET or whatever)? Or are you and Rasmus talking about two different proposals? George

Derick Rethans

21 years ago
On Fri, 12 Aug 2005, George Schlossnagle wrote:
> > I wrote up the following spec for this extension: > > http://files.derickrethans.nl/filter_extension.html > > Where's the part about an application swapping back for the raw arrays (as > opposed to accessing them specifically as _RAW_GET or whatever)? Or are you > and Rasmus talking about two different proposals?
Nah, we discussed this thing for a bit, but I didn't add that function yet to this RFC. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

George Schlossnagle

21 years ago
On Aug 13, 2005, at 8:14 AM, Derick Rethans wrote:
> On Fri, 12 Aug 2005, George Schlossnagle wrote: > > >>> I wrote up the following spec for this extension: >>> http://files.derickrethans.nl/filter_extension.html >>> >> >> Where's the part about an application swapping back for the raw >> arrays (as >> opposed to accessing them specifically as _RAW_GET or whatever)? >> Or are you >> and Rasmus talking about two different proposals? >> > > Nah, we discussed this thing for a bit, but I didn't add that function > yet to this RFC.
Good. That function would be evil (imho). Given that you can't access super-globals as variable-variables, I think that having to really get at _RAW_GET[] will make it much more transparent when an application is using unfiltered data. George

Derick Rethans

21 years ago
On Sat, 13 Aug 2005, George Schlossnagle wrote:
> Good. That function would be evil (imho). Given that you can't access > super-globals as variable-variables, I think that having to really get at > _RAW_GET[] will make it much more transparent when an application is using > unfiltered data.
But then everybody will just start using $_RAW_GET instead of $_GET. What will that solve? Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Sean Coates

21 years ago
> But then everybody will just start using $_RAW_GET instead of $_GET. > What will that solve?
This was one of my concerns. $_RAW_* is easy to grep for, though. Sure, it can still be abused, but it'll be a lot easier to see WHERE it's being abused. Currently, a grep for $_GET will return a large number of false positives when searching for XSS (because it's the most legit way of finding data entry points). S

Ilia A.

21 years ago
Derick, That would not be much different then someone doing foreach (array_keys($_GET) $v) $_GET[$v] = get_raw(GET, $v); If anything locating RAW super-global would be easier, making auditing coding reliant on it a bit simpler. IMHO. Derick Rethans wrote:

George Schlossnagle

21 years ago
On Aug 13, 2005, at 3:21 PM, Derick Rethans wrote:
> On Sat, 13 Aug 2005, George Schlossnagle wrote: > > >> Good. That function would be evil (imho). Given that you can't >> access >> super-globals as variable-variables, I think that having to really >> get at >> _RAW_GET[] will make it much more transparent when an application >> is using >> unfiltered data. >> > > But then everybody will just start using $_RAW_GET instead of $_GET. > What will that solve?
No... reasonable people will use _GET. Applications that need to use _RAW_GET will do so, and (due to the lack of variable variables support for it) be easy to track down. With a function it's much harder to track when you're getting the filtered attay or the raw array. George

Pierre-Alain Joye

21 years ago
On Fri, 12 Aug 2005 20:19:04 +0200 (CEST) derick@php.net (Derick Rethans) wrote:
> On Fri, 12 Aug 2005, George Schlossnagle wrote: > > > > 3. Add input filter extension which will include a mechanism > > > for application developers to very easily turn it off which > > > would swap the raw GPC arrays back in case the site had it > > > turned on by default. > > > > That seems a bit scary, and almost as if it would defeat the > > purpose. I'm all for an input filter extension, but it should > > be one that can't be easily neutered by (potentially malicious) > > applications. > > I wrote up the following spec for this extension: > http://files.derickrethans.nl/filter_extension.html
It lools globally good for the principles. Details can be changed during implementation/experimentations phases. I only disagree with E_NOTICE. All these validations should be silent. Derick, as far as I remember, you have some doubts about that too. As you may noticed before, I have some problems with noisy functions in general :) Regards, --Pierre

Sebastian Bergmann

21 years ago
George Schlossnagle schrieb:
> Radically change all the operator syntaxes.
http://www.gravitonic.com/software/php/patches/ze2_concat_obj_op.diff.gz :-)
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Marcus Börger

21 years ago
Hello Sebastian, why is this on gravitonic.com ? anyway. If we'd use the VBA operator for that then we could use the '.' for namespaces and wouldn't run into any trouble with namespaces at all. Besides someone wanted to have functions in namespaces. marcus Friday, August 12, 2005, 8:29:29 PM, you wrote:
> George Schlossnagle schrieb: >> Radically change all the operator syntaxes.
> http://www.gravitonic.com/software/php/patches/ze2_concat_obj_op.diff.gz
> :-)
> -- > Sebastian Bergmann http://www.sebastian-bergmann.de/ > GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69
Best regards, Marcus

Sebastian Bergmann

21 years ago
Marcus Boerger schrieb:
> why is this on gravitonic.com ?
Ask Andrei, it's been there for ages.
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Derick Rethans

21 years ago
On Sat, 13 Aug 2005, Marcus Boerger wrote:
> Hello Sebastian, > > why is this on gravitonic.com ? > > anyway. If we'd use the VBA operator for that then we could use the '.' > for namespaces and wouldn't run into any trouble with namespaces at all. > Besides someone wanted to have functions in namespaces.
George mentioned this as a joke... Derick

Xuefer Tinys

21 years ago
i'd suppose u guys going to deprecate+E_STRICT first, remove later
> > George Schlossnagle schrieb: > >> Radically change all the operator syntaxes. > > > http://www.gravitonic.com/software/php/patches/ze2_concat_obj_op.diff.gz >
FYI: _ is validate char in variable/function name _("Hello! world"); // gettext define('_', 1); echo _; On 8/13/05, Marcus Boerger <helly@php.net> wrote:
> Hello Sebastian, > > why is this on gravitonic.com ? > > anyway. If we'd use the VBA operator for that then we could use the '.' > for namespaces and wouldn't run into any trouble with namespaces at all. > Besides someone wanted to have functions in namespaces. > > marcus > > Friday, August 12, 2005, 8:29:29 PM, you wrote: >
VB use & for string concat. they said & is faster as + is used for number addition. flash4 actionscript use another magic looking operator but changed to "." in v5 too looks like there's no more single character for "string concat" operator for php if u take the dot away. lua use double dot. i saw some code written as: $myarray[def] = $HTTP_GET_VARS[abc]; both abc and def is not constant. it seems they're wishing to use $myarray.def while they hate $myarray["def"], but can only use $myarray[def] instead. untill they recognized there's a warning as def is treat as constant first. why the hell we can use "." or something else simple for frequent purpose (array value/obj property) the way javascript do looks quite simple. both "." and "[]" can access array/object anyway, they can't +1 for this as it break all scripts with hardly a hack for BC

Adam Maccabee Trachtenberg

21 years ago
On Fri, 12 Aug 2005, George Schlossnagle wrote:
> 9. Radically change all the operator syntaxes. Oh wait, that's Perl > 6.0, sorry.
In the same spirit, on my PHP 7.0 wishlist are Unicode operators. :) -adam
-- adam@trachtenberg.com | http://www.trachtenberg.com author of o'reilly's "upgrading to php 5" and "php cookbook" avoid the holiday rush, buy your copies today!

Sterling Hughes

21 years ago
+1 to all things here. -Sterling On 8/12/05, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:

Sebastian Bergmann

21 years ago
Rasmus Lerdorf schrieb:
> 1. Remove register_globals completely
+1
> 2. Remove magic_quotes_*
+1
> 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would > swap the raw GPC arrays back in case the site had it turned > on by default.
+1
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
+1
> 6. Remove some stuff that has been marked deprecated since PHP 3/4
+1
> 7. Make identifiers case-sensitive
+1
> 8. Remove various function aliases
+1
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Pierre-Alain Joye

21 years ago
Hello, +1 to all things, same comment as the opcode cache Ilia's one. I would like to add one from my wishes: Bump version for the required library as high as possible (or realist) and do not support museum softwares at all, like droping freetype v1 for example. Most of the users do not use it anymore, but it will make the whole much more clean and easier to maintain. --Pierre

Ilia A.

21 years ago
This is a very good, point we really should drop support for things like gd1 (no reason anymore, latest versions (including bundled) have GIF support). These only add a hundreds of ifdefs to the code or prevent usage of new(er) functionality. IMHO we should see what is the lowest possible version of a lib distributed by commonly used distro and upgrade our requirements to @ least that version. Ilia Pierre-Alain Joye wrote:

Darrell Brogdon

21 years ago
Maybe this is too far reaching but what about making function parameter orders consistent? For example, make in_array() require in_array(array haystack, mixed needle[...) just as most of the string functions. -D On Aug 12, 2005, at 12:32 PM, Ilia Alshanetsky wrote:
> This is a very good, point we really should drop support for things > like > gd1 (no reason anymore, latest versions (including bundled) have GIF > support). These only add a hundreds of ifdefs to the code or prevent > usage of new(er) functionality. > > IMHO we should see what is the lowest possible version of a lib > distributed by commonly used distro and upgrade our requirements to @ > least that version. > > Ilia > > Pierre-Alain Joye wrote: > >> Hello, >> >> +1 to all things, same comment as the opcode cache Ilia's one. >> >> I would like to add one from my wishes: >> >> Bump version for the required library as high as possible (or >> realist) and do not support museum softwares at all, like droping >> freetype v1 for example. Most of the users do not use it anymore, >> but it will make the whole much more clean and easier to maintain. >> >> --Pierre >> >> > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >
Darrell Brogdon darrell@brogdon.net http://darrell.brogdon.net

Jani Taskinen

21 years ago
Very good idea. We do bundle the thing? :) --Jani On Fri, 12 Aug 2005, Ilia Alshanetsky wrote:

Pierre-Alain Joye

21 years ago
On Sat, 13 Aug 2005 00:21:29 +0300 (EEST) sniper@iki.fi (Jani Taskinen) wrote:
> > Very good idea. We do bundle the thing? :)
I do not think we can use the extern GD2 in the same nice way than we use ours. But droping _extern_ gd2 support is possible. The only remaining thing is to check that we will be really binary compatible. Regards, --Pierre

Jani Taskinen

21 years ago
On Fri, 12 Aug 2005, Pierre-Alain Joye wrote:
> On Sat, 13 Aug 2005 00:21:29 +0300 (EEST) > sniper@iki.fi (Jani Taskinen) wrote: > >> >> Very good idea. We do bundle the thing? :) > > I do not think we can use the extern GD2 in the same nice way than > we use ours. > > But droping _extern_ gd2 support is possible. The only remaining > thing is to check that we will be really binary compatible.
I don't think dropping the external library linking support is such a good idea. Just nuke GD1 support. (gotta start somewhere :) --Jani

Antony Dovgal

21 years ago
I would like to add item #9: * start commenting the code, plz * As long as we don't have any documentation describing internals, comments in the code are something I personally would _really_ like to see. And the more the better. On Fri, 12 Aug 2005 10:48:20 -0700 Rasmus Lerdorf <rasmus@lerdorf.com> wrote:
> Since we are breaking a lot of stuff in 6.0, at least with > Unicode_semantics=On I am wondering if it may not be time to break some > more stuff and do a bit of spring cleaning. It would mean many apps > would need some work to work on PHP 6, but at the same time I think it > is work people would welcome since it would mostly involve removing > hacks instead of adding them. And yes, I know this is pretty > controversial, so take a few deep breaths before replying, please. > > 1. Remove register_globals completely > > 2. Remove magic_quotes_* > > 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default. > > 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in. > > 5. Remove safe_mode and focus on open_basedir > > 6. Remove some stuff that has been marked deprecated since PHP 3/4 > > A couple of others that we could consider, but I don't actually think > wins us much apart from academic purity (which I have never been all > that keen on) are: > > 7. Make identifiers case-sensitive > > 8. Remove various function aliases > > -Rasmus > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >
-- Wbr, Antony Dovgal

David Zülke

21 years ago
+1 to all of these. I have a #9 to share, too: Assuming that PHP 6.0 will also have namespaces support (which would be cool), it might make sense to move all internal functions to use namespaces (if they support functions sitting in there - doesn't seem like Jessie's current patch will, but then, maybe there's a chance). That way, we could clean up naming inconsistencies (think of all the str* functions), and maybe even some of the common annoyances when it comes to parameter order (haystack, needle vs. needle, haystack) Just a thought. - David

Marco Tabini

21 years ago
On 8/12/05 2:50 PM, "David Zülke" <dz@bitxtender.com> wrote:
> I have a #9 to share, too: > Assuming that PHP 6.0 will also have namespaces support (which would be > cool), it might make sense to move all internal functions to use namespaces > (if they support functions sitting in there - doesn't seem like Jessie's > current patch will, but then, maybe there's a chance). That way, we could > clean up naming inconsistencies (think of all the str* functions), and maybe > even some of the common annoyances when it comes to parameter order > (haystack, needle vs. needle, haystack) >
I thought about suggesting this (or something like it)... But unlike anything that Rasmus has suggested, doing this will be dramatically destabilizing to *every* single PHP script, unless the platform also maintains a massive alias list--which is of course what Rasmus was trying to get rid of anyway :) Mt.

David Zülke

21 years ago
Duh... "internal functions" is the wrong term, of course. I mean all the functions that ship with PHP. The old ones would still be available, but you could do PHP.String.pos() and stuff like that alternatively. - David

Ilia A.

21 years ago
> I have a #9 to share, too: > Assuming that PHP 6.0 will also have namespaces support (which would be > cool), it might make sense to move all internal functions to use namespaces > (if they support functions sitting in there - doesn't seem like Jessie's > current patch will, but then, maybe there's a chance). That way, we could > clean up naming inconsistencies (think of all the str* functions), and maybe > even some of the common annoyances when it comes to parameter order > (haystack, needle vs. needle, haystack)
-1 to namespaces. As for modifying functions that would require a fair number of function aliases for BC as untold number of scripts will break. That is something we are trying to eliminate in the first place. Ilia

Marco Tabini

21 years ago
Hey Ilia, On 8/12/05 3:03 PM, "Ilia Alshanetsky" <ilia@prohost.org> wrote:
> > -1 to namespaces. As for modifying functions that would require a fair > number of function aliases for BC as untold number of scripts will > break. That is something we are trying to eliminate in the first place. >
With namespaces, wouldn't the problem go away altogether? Old function names can be deprecated and E_STRICT'ed and a new, uniform naming convention and parameter order be enforced for the future. I hate namespaces but this sounds like a good solution to me. Mt.

Alan Knowles

21 years ago
How about running from serialized opcode memory block (rather than array of struct'd opcodes...), so writing a thread extension is alot easier ;) Oh well, I can always dream... Regards Alan On Fri, 2005-08-12 at 23:27 -0400, Marco Tabini wrote:

Ilia A.

21 years ago
Why would I need name spaces for basic functions, just so that I need to rename all my code to use str:replace rather then str_replace and perform 2 hash table lookups? Ilia Marco Tabini wrote:

Marco Tabini

21 years ago
On 8/13/05 2:25 AM, "Ilia Alshanetsky" <ilia@prohost.org> wrote:
> Why would I need name spaces for basic functions, just so that I need to > rename all my code to use str:replace rather then str_replace and > perform 2 hash table lookups? >
Or maybe so that you don't have to look at the manual fifteen times a minute so that you can remember whether the needle goes before the haystack in a particular function or not. I'm not saying it's the perfect solution, but it's a good opportunity to clean things up a bit. Or it can be done in the global namespace and forget about namespaces altogether--I don't care much for them either, but I do think that consistent function naming and parameter ordering is an opportunity worth taking advantage of, that's all. Marco
> Ilia > > Marco Tabini wrote: >> Hey Ilia, >> >> On 8/12/05 3:03 PM, "Ilia Alshanetsky" <ilia@prohost.org> wrote: >> >>> -1 to namespaces. As for modifying functions that would require a fair >>> number of function aliases for BC as untold number of scripts will >>> break. That is something we are trying to eliminate in the first place. >>> >> >> >> >> With namespaces, wouldn't the problem go away altogether? Old function names >> can be deprecated and E_STRICT'ed and a new, uniform naming convention and >> parameter order be enforced for the future. I hate namespaces but this >> sounds like a good solution to me. >> >> >> Mt. >> >> >> >>
-- Marco Tabini President & CEO Marco Tabini & Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057

Xuefer Tinys

21 years ago
On 8/13/05, Marco Tabini <marcot@tabini.ca> wrote:
> > On 8/13/05 2:25 AM, "Ilia Alshanetsky" <ilia@prohost.org> wrote: > > > Why would I need name spaces for basic functions, just so that I need to > > rename all my code to use str:replace rather then str_replace and > > perform 2 hash table lookups? > > > > Or maybe so that you don't have to look at the manual fifteen times a minute > so that you can remember whether the needle goes before the haystack in a > particular function or not. > > I'm not saying it's the perfect solution, but it's a good opportunity to > clean things up a bit. Or it can be done in the global namespace and forget > about namespaces altogether--I don't care much for them either, but I do > think that consistent function naming and parameter ordering is an > opportunity worth taking advantage of, that's all. >
yeah, php is meant to be simple. php functions was sadly decided by the each one who introduced it, with little standard applied. can u imagine how many php scripters is checking manual right now? +10 to solve the situation. but !@# 0 waiting for a good way without breaking old scripts. possibly make a internal or loadable "argument reposition table", enabled with: declare(fix_function_argument_position); fix at compile time, no performance lost on runtime. but might confuse the debuger if the origin position in source is forget after compile can't help for class method as class is unknown at compile time

Joseph Crawford

21 years ago
+1 for namespaces +1 for making current functions into namespaces +1 for removing register_globals
-- Joseph Crawford Jr. Codebowl Solutions, Inc. 1-802-671-2021 codebowl@gmail.com

Lukas Smith

21 years ago
Xuefer wrote:
> possibly make a internal or loadable "argument reposition table", enabled with: > declare(fix_function_argument_position); > fix at compile time, no performance lost on runtime. > but might confuse the debuger if the origin position in source is > forget after compile
As I suggested by using runkit (AFAIK it could be extended to be able to intercept calls to internal fuctions .. if it cant do that already) we could provide a BC lib for every BC break we make due to parameter order changing. PEAR::PHP_Compat could be used to fix up all the changed function names or dropped alias. regards, Lukas

Jani Taskinen

21 years ago
On Sat, 13 Aug 2005, Lukas Smith wrote:
> Xuefer wrote: > >> possibly make a internal or loadable "argument reposition table", enabled >> with: >> declare(fix_function_argument_position); >> fix at compile time, no performance lost on runtime. >> but might confuse the debuger if the origin position in source is >> forget after compile > > As I suggested by using runkit (AFAIK it could be extended to be able to > intercept calls to internal fuctions .. if it cant do that already) we could > provide a BC lib for every BC break we make due to parameter order changing. > > PEAR::PHP_Compat could be used to fix up all the changed function names or > dropped alias.
Or do that the other way around: Provide the changed ones in there for forward compatibility and just break it hard on PHP 6. :) --Jani

Jani Taskinen

21 years ago
On Sat, 13 Aug 2005, Marco Tabini wrote:
> Or maybe so that you don't have to look at the manual fifteen times a minute > so that you can remember whether the needle goes before the haystack in a > particular function or not.
I'm all for making this consistent all around. Best way to get this done is propably to first come up with a list of functions which are inconsistent? And get a concensus over it. :) This is the first one that comes to my mind: int strpos (string haystack, mixed needle [, int offset]) Whenever I've used that, I've ALWAYS mixed the needle with haystack. Same goes with every str* function, I guess.. --Jani

Sara Golemon

21 years ago
> This is the first one that comes to my mind: > > int strpos (string haystack, mixed needle [, int offset]) >
And this is why they're inconsistent to begin with. When I look at strpos() I think: strchr(char *, int) So the parameter ordering does make sense there (to me). -Sara

Jani Taskinen

21 years ago
On Sat, 13 Aug 2005, Sara Golemon wrote:
>> This is the first one that comes to my mind: >> >> int strpos (string haystack, mixed needle [, int offset]) >> > And this is why they're inconsistent to begin with. When I look at strpos() I > think: strchr(char *, int) So the parameter ordering does make sense there > (to me).
Yes, coming from a C background you would think like that. But when you think about it with some logic (not women's logic :): "I'm looking for a character inside a string." Thus: strpos(needle, haystack) is the correct way (tm) =) --Jani

Ryan King

21 years ago
On Aug 13, 2005, at 6:50 PM, Jani Taskinen wrote:
> On Sat, 13 Aug 2005, Sara Golemon wrote: >>> This is the first one that comes to my mind: >>> int strpos (string haystack, mixed needle [, int offset]) >> And this is why they're inconsistent to begin with. When I look >> at strpos() I think: strchr(char *, int) So the parameter >> ordering does make sense there (to me). > > Yes, coming from a C background you would think like that. > But when you think about it with some logic (not women's logic :): > > "I'm looking for a character inside a string."
Or looking for a *needle* in a *haystack*. -ryan
> > Thus: strpos(needle, haystack) is the correct way (tm) =)
I agree, though I don't really care so long as its the same in all the str* and array* functions -ryan

Xuefer Tinys

21 years ago
> >> This is the first one that comes to my mind: > >> > >> int strpos (string haystack, mixed needle [, int offset]) > >> > > And this is why they're inconsistent to begin with. When I look at strpos() I > > think: strchr(char *, int) So the parameter ordering does make sense there > > (to me). > > Yes, coming from a C background you would think like that. > But when you think about it with some logic (not women's logic :): > > "I'm looking for a character inside a string." > > Thus: strpos(needle, haystack) is the correct way (tm) =)
no, it should be "$a = (look for $needle inside $hystack);", and can never be a php language if we always strict the garmmar of native language to be a basic of a programming language, we might mixed everything up. until the day your computer passed turin turing test.
> I agree, though I don't really care so long as its the same in all > the str* and array* functions
but sadly it's not. for str_replace, the 3rd argument is more or less a "haystack" and the 1st argument is needle

Aidan Lister

21 years ago
"Jani Taskinen" <sniper@iki.fi> wrote in message news:Pine.LNX.4.61.0508140342570.20280@arfg.argcubovn.sv...
> On Sat, 13 Aug 2005, Marco Tabini wrote: > >> Or maybe so that you don't have to look at the manual fifteen times a >> minute >> so that you can remember whether the needle goes before the haystack in a >> particular function or not. > > I'm all for making this consistent all around. > Best way to get this done is propably to first come up > with a list of functions which are inconsistent? > And get a concensus over it. :) > > This is the first one that comes to my mind: > > int strpos (string haystack, mixed needle [, int offset]) > > Whenever I've used that, I've ALWAYS mixed the needle with haystack. > Same goes with every str* function, I guess.. > > --Jani
I think PHP 6.0 provides an excellent opportunity to rectify a huge number of frustrating inconsistencies; it would be a shame not to make the most of this. The two biggest inconsistencies raised by users and "language comparison" groups are a) function argument order, and b) function naming. Granted, swapping the arguments will be nightmarish for the users. However, we have a long time to discuss possibilities to alleviate the problem. I agree with Jani, a list of inconsistencies should be compiled and discussed. If it is decided that swapping the function arguments around would be too cataclysmic for upgrading users, we should at the very least institute a new strict function naming policy. My favourite example of inconsistency is htmlentities and html_entity_decode. These are easy to fix, and a relatively easy BC break for the user to deal with. I suggest we extend Jani's previous suggestion; by including a list of function name inconsistencies in the discussion. Kind regards, Aidan Lister

Xuefer Tinys

21 years ago
> I think PHP 6.0 provides an excellent opportunity to rectify a huge number > of frustrating inconsistencies; it would be a shame not to make the most of > this. > > > > The two biggest inconsistencies raised by users and "language comparison" > groups are a) function argument order, and b) function naming. > > > > Granted, swapping the arguments will be nightmarish for the users. However, > we have a long time to discuss possibilities to alleviate the problem. I > agree with Jani, a list of inconsistencies should be compiled and discussed. > > > > If it is decided that swapping the function arguments around would be too > cataclysmic for upgrading users, we should at the very least institute a new > strict function naming policy. > > My favourite example of inconsistency is htmlentities and > html_entity_decode. These are easy to fix, and a relatively easy BC break > for the user to deal with. > > > I suggest we extend Jani's previous suggestion; by including a list of > function name inconsistencies in the discussion.
ppl might use the dirty but fast function instead of a wrapper which is slow and have to remember new function name
>
so there is a "declare". but even with "declare" ppl writing new code while still have to maintain old code get crazy although php-internals guys should jump out and say "hey, php is not java. not everything is object", but here's another idea. still, with the "argument swaping table" but write as a object alike syntax instead: $str = $str->str_replace($needle, $replacement); $str = $str->preg_replace($regex, $replacement); $str is scalar, NOT and never an object. and there's no auto boxing/unboxing, no properties, as no "new String()" (to make php-dev please) ========= wish about lamda function constructor: having to write a callback at far away, and use it in preg_replace_callback, make writing/maintain code harder function callback_1($matches) { } other callbacks here.... $str = preg_replace_callback("/../", "callback_1", $str); $str = preg_replace_callback("/../", "callback_2", $str); etc. using create_function() is 1. quite confusing as the code has to be in string 2. might also lead to code injection as eval(). 3. cannot be cached/optimized by apc or so. (md5 the whole code string as a key?) $start = .. $end = .. $str = preg_replace_callback("/../", "callback_1", function ($matches) { return $start . $matches[1] . $end; }); is really nice. but "scope" in such function need to be discussed. accessing variables of parent function inside lamda(child) function is useful most of the time.

Sean Coates

21 years ago
It occurred to me, while reading different parts of this thread, that if the named parameter feature makes it in to PHP 6.0, there's a solution for both sides of the parameter order argument. 1) yes, would be really nice to clean up the param order for two main reasons: a) constant manual checking b) people whine about param order, incessantly 2) yes, changing this order would break many years of code Named parameters, no matter what the syntax, as long as it is implemented throughout PHP's function-space, will solve this cleanly: strpos(needle: $foo, haystack: $bar) strpos(needle: $bar, haystack: $foo) This /is/ going to be a headache to implement and document, though. S

André Luis Ferreira da Silva Bacci

21 years ago
Aidan Lister wrote:
> I think PHP 6.0 provides an excellent opportunity to rectify a huge number > of frustrating inconsistencies; it would be a shame not to make the most of > this. > > The two biggest inconsistencies raised by users and "language comparison" > groups are a) function argument order, and b) function naming. > > Granted, swapping the arguments will be nightmarish for the users. However, > we have a long time to discuss possibilities to alleviate the problem. I > agree with Jani, a list of inconsistencies should be compiled and discussed. > > If it is decided that swapping the function arguments around would be too > cataclysmic for upgrading users, we should at the very least institute a new > strict function naming policy. > > My favourite example of inconsistency is htmlentities and > html_entity_decode. These are easy to fix, and a relatively easy BC break > for the user to deal with. > > I suggest we extend Jani's previous suggestion; by including a list of > function name inconsistencies in the discussion.
Or... <?php6 ... pure PHP 6 mode ?> <?php ... Some sort of BC ?> []s André AE

Sara Golemon

21 years ago
> <?php6 > ... pure PHP 6 mode > ?> > > <?php > ... Some sort of BC > ?> > > []s >
One of the primary goal on the table is to >simplify< things as we go into PHP6. This is the antithesis of simplification. Not gonna happen. -Sara

Jessie Hernandez

21 years ago
Hi Ilia, While it really doesn't matter to me if functions are namespaced or not, or even if functions are allowed inside namespaces, I just want to clarify that only one hash table lookup would be done (as I said in my previous post, this change was very simple, but all it did was allow the use of colons in function CALLs). The colon would be part of the function name, that's why no performance would be lost. Regards, Jessie Ilia Alshanetsky wrote:

Ilia A.

21 years ago
If all you are doing is allowing a colon in the name and renaming all the functions from str_foo to str:foo, I see this as complete pointless, only increasing the wtf factor. And requiring everyone to rewrite their scripts. Ilia Jessie Hernandez wrote:

Derick Rethans

21 years ago
On Fri, 12 Aug 2005, Ilia Alshanetsky wrote:
> > I have a #9 to share, too: > > Assuming that PHP 6.0 will also have namespaces support (which would be > > cool), it might make sense to move all internal functions to use namespaces > > (if they support functions sitting in there - doesn't seem like Jessie's > > current patch will, but then, maybe there's a chance). That way, we could > > clean up naming inconsistencies (think of all the str* functions), and maybe > > even some of the common annoyances when it comes to parameter order > > (haystack, needle vs. needle, haystack) > > -1 to namespaces. As for modifying functions that would require a fair > number of function aliases for BC as untold number of scripts will > break. That is something we are trying to eliminate in the first place.
Agreed. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Pierre-Alain Joye

21 years ago
On Fri, 12 Aug 2005 15:03:36 -0400 ilia@prohost.org (Ilia Alshanetsky) wrote:
> > I have a #9 to share, too: > > Assuming that PHP 6.0 will also have namespaces support (which > > would be cool), it might make sense to move all internal > > functions to use namespaces (if they support functions sitting > > in there - doesn't seem like Jessie's current patch will, but > > then, maybe there's a chance). That way, we could clean up > > naming inconsistencies (think of all the str* functions), and > > maybe even some of the common annoyances when it comes to > > parameter order (haystack, needle vs. needle, haystack) > > -1 to namespaces. As for modifying functions that would require a > fair number of function aliases for BC as untold number of > scripts will break. That is something we are trying to eliminate > in the first place.
I have no oppinion on namespace, I lived the past years without (and without exceptions for the record ;) and was somehow pretty happy. I may see some usages but they fit not that good in a language like php (talking about the way it works). About BC and PHP 6.0, this is irrelevant. We are sticked during all .x releases with BC. Now we have a chance to clean what we think we should clean, BC is not a good argument here, inconsistencies can be one, "overkilled" too ;) Regards, --Pierre

Jessie Hernandez

21 years ago
David, Don't know if you read my post from last night, but I played around with functions in namespaces and they worked (the change was pretty easy). Though all this allowed was the following: <?php namespace test_ns { function test_func { echo "hello!\n"; } } test_func(); // generates an error, 'test_func' does not exist test_ns:test_func(); // prints "hello!" ?> So, for your string example, all this would buy is that you'd call str:replace instead of str_replace (you can use a colon, basically). As I mentioned in the post, imports do not fit very well for functions, as the current namespace import logic is handed off to __autoload, and there is no such thing for functions. Based on the replies, it seems that most would agree with only allowing classes inside namespaces. Either way, I was thinking this morning of a simplified syntax to achieve the "import class/function foo from bar" behavior: import test_ns:test_class [as other_class_name]; // class import import test_ns:test_func() [as other_func_name]; // function import import test_ns:$test_var [as $other_var_name]; // variable imports?? (if supported) I personally would just stay with classes. As it is now, if you need a function that can be used inside a namespace, you can just add a "globals" class and add a static method there. If you need a namespace-global variable, you can also just declare a "globals" class and add a public member variable to it. So only allowing classes inside namespaces is not a real limitation to begin with. Regards, Jessie "David Zülke" <dz@bitxtender.com> wrote in message news:B1.AB.33075.09FECF24@pb1.pair.com...
> +1 to all of these. > > I have a #9 to share, too: > Assuming that PHP 6.0 will also have namespaces support (which would be > cool), it might make sense to move all internal functions to use
namespaces
> (if they support functions sitting in there - doesn't seem like Jessie's > current patch will, but then, maybe there's a chance). That way, we could > clean up naming inconsistencies (think of all the str* functions), and
maybe

Davey

21 years ago
As little as it means, +1 - Davey Rasmus Lerdorf wrote:

Tobias Schlitt

21 years ago
Hi Davey Shafik! On 08/12/05 20:56 you wrote:
> As little as it means, +1
Same from here! :) Cheers! Toby
-- Tobias Schlitt - Zend Certified Engineer GPG Key: 0xA6529579 a passion for php http://www.schlitt.info Like to say "thank you"? - http://pear.php.net/wishlist.php/toby

Sara Golemon

21 years ago
> 1. Remove register_globals completely >
Amen! +1
> 2. Remove magic_quotes_* >
Hallelujiah! +1
> 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default. >
Eh... +0
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in. >
Okay... +0
> 5. Remove safe_mode and focus on open_basedir >
+1 on dropping safe_mode, and here's a thought for open_basedir. I was thinking about a comment made in another thread... how about open_basedir_child(bool). When enabled, only files at or below the directory in which the current script is executed from may be opened. There may be some SAPIs where this is problematic (since we may not know what directory the file is opened from reliably), but it's worth looking into.
> 6. Remove some stuff that has been marked deprecated since PHP 3/4 >
Praise non-denominational-diety! +1 Though my definition of "remove" would actually be "migrate to siberia". Whole modules where appropriate. "deprecation" collections where not.
> A couple of others that we could consider, but I don't actually think > wins us much apart from academic purity (which I have never been all > that keen on) are: > > 7. Make identifiers case-sensitive >
Or perhaps optionally case sensitive? I dunno, I've made my peace with PHP being (mostly) case-insensitive.
> 8. Remove various function aliases >
Many of these fall under #6 honestly. I can think of a few that can fall by the wayside. #9... No.... must...resist....four-letter-token....can-of-worms....mmmmggmhghmhhmmhgmhmgm mmm * otherbird sneaks up behind Sara and clamps her mouth shut before the genie is released.

Derick Rethans

21 years ago
On Fri, 12 Aug 2005, Sara Golemon wrote:
> > 7. Make identifiers case-sensitive > > > Or perhaps optionally case sensitive? I dunno, I've made my peace with PHP > being (mostly) case-insensitive.
We can't make it optional... that would be just too much problems for writing portable scripts. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Marcus Börger

21 years ago
Hello Derick, Saturday, August 13, 2005, 2:17:52 PM, you wrote:
> On Fri, 12 Aug 2005, Sara Golemon wrote:
>> > 7. Make identifiers case-sensitive >> > >> Or perhaps optionally case sensitive? I dunno, I've made my peace with PHP >> being (mostly) case-insensitive.
> We can't make it optional... that would be just too much problems for > writing portable scripts.
hu? How isn't always using the right casing un-portable if allowing case-insensitivity also? You mean becuase one might use function bullshit()...and function Bullshit()...and function bullShit()...? If so, i guess you know how to write portable apps - test them with everything supported - in this case with and w/o case-insensitivity. Thus your argument is untrue. And the try of disproval above, look at the used names. Best regards, Marcus

Marcus Börger

21 years ago
Hello internals, Saturday, August 13, 2005, 2:58:26 PM, you wrote:
> Hello Derick,
> Saturday, August 13, 2005, 2:17:52 PM, you wrote:
>> On Fri, 12 Aug 2005, Sara Golemon wrote:
>>> > 7. Make identifiers case-sensitive >>> > >>> Or perhaps optionally case sensitive? I dunno, I've made my peace with PHP >>> being (mostly) case-insensitive.
>> We can't make it optional... that would be just too much problems for >> writing portable scripts.
> hu? How isn't always using the right casing un-portable if allowing > case-insensitivity also? You mean becuase one might use > function bullshit()...and > function Bullshit()...and > function bullShit()...? > If so, i guess you know how to write portable apps - test them with > everything supported - in this case with and w/o case-insensitivity. > Thus your argument is untrue. And the try of disproval above, look > at the used names.
to prevent confusion with more readers - i am against an ini option here. Either keep the way it is right now or make everything case sensitive. And of course i like speed which is support for the latter to be clear. Best regards, Marcus

Ants Aasma

21 years ago
Marcus Boerger wrote:
> to prevent confusion with more readers - i am against an ini option here. > Either keep the way it is right now or make everything case sensitive. > And of course i like speed which is support for the latter to be clear.
What about deprecating case-insensitive identifiers but keeping them working. Wouldn't something like following work? lookup case-sensitive identifier if not found then lookup case-insensitive identifier if found then raise notice/warning and continue as usual else fall down and catch fire That way correct usage should be fast and incorrect usage work. And the case-insensitive fallback could be removed in PHP7 :) --- Ants Aasma

Derick Rethans

21 years ago
On Sat, 13 Aug 2005, Marcus Boerger wrote:
> Hello Derick, > > Saturday, August 13, 2005, 2:17:52 PM, you wrote: > > > On Fri, 12 Aug 2005, Sara Golemon wrote: > > >> > 7. Make identifiers case-sensitive > >> > > >> Or perhaps optionally case sensitive? I dunno, I've made my peace with PHP > >> being (mostly) case-insensitive. > > > We can't make it optional... that would be just too much problems for > > writing portable scripts. > > hu? How isn't always using the right casing un-portable if allowing > case-insensitivity also? You mean becuase one might use > function bullshit()...and > function Bullshit()...and > function bullShit()...? > If so, i guess you know how to write portable apps - test them with > everything supported - in this case with and w/o case-insensitivity.
Yes, I know how to do that, but I'm not everybody. I already see people doing: function FooBar() { } fooBar(); or: GetImageSize() in their script. This will work fine if your ini setting says that it is allowed, but as soon as you move it to a server where the setting is set to off, your application stops working. So there is definitely an issue here. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Pierre-Alain Joye

21 years ago
On Sat, 13 Aug 2005 14:17:52 +0200 (CEST) derick@php.net (Derick Rethans) wrote:
> On Fri, 12 Aug 2005, Sara Golemon wrote: > > > > 7. Make identifiers case-sensitive > > > > > Or perhaps optionally case sensitive? I dunno, I've made my > > peace with PHP being (mostly) case-insensitive. > > We can't make it optional... that would be just too much problems > for writing portable scripts.
The problem is not the portability but the internals, I think that too much options make the whole thing way too complicated. short version, do it or not, not optional :) --Pierre

Michael Wallner

21 years ago
Rasmus Lerdorf wrote: [lots of reasonable points] What about moving some/many extensions from core to pecl? Regards, Mike

Ilia A.

21 years ago
Jani and Derick have so far done a very good job doing that, I think just about all uncommon extensions have been migrated. But, if something was missed moving it to pecl would be a good idea. Ilia Michael Wallner wrote:

Wez Furlong

21 years ago
A reasonable goal would be to make sure that all our extensions are full pecl citizens, so that intermediate fixes to any of these so called "core" extensions could be released via PECL very easily. One of the biggest gripes our SA's have is that if they forget to enable a core PHP extension and later need to add it, there is no easy way to pull it in, short of recompiling PHP again. --Wez. On 8/12/05, Michael Wallner <mike@php.net> wrote:

Wez Furlong

21 years ago
PS: This doesn't necessarily mean that they all need to be physically unbundled from the main distro. --Wez. On 8/12/05, Wez Furlong <kingwez@gmail.com> wrote:

Michael Wallner

21 years ago
Wez Furlong wrote:
> On 8/12/05, Wez Furlong <kingwez@gmail.com> wrote: > >>A reasonable goal would be to make sure that all our extensions are >>full pecl citizens, so that intermediate fixes to any of these so >>called "core" extensions could be released via PECL very easily. >> >>One of the biggest gripes our SA's have is that if they forget to >>enable a core PHP extension and later need to add it, there is no easy >>way to pull it in, short of recompiling PHP again.
> PS: This doesn't necessarily mean that they all need to be physically > unbundled from the main distro.
Exactly, couldn't have said that better. Mike

steve roussey

21 years ago
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
I have no karma to +1, but would if I could. It would be wonderful if something like xdebug could profile with op code cache on as well, should it be possible. :) -steve--

Derick Rethans

21 years ago
On Fri, 12 Aug 2005, steve roussey wrote:
> > 4. Include an opcode cache by default. A lot of work has gone into > > pecl/apc recently, but I am not hung up on which one goes in. > > I have no karma to +1, but would if I could. It would be wonderful if > something like xdebug could profile with op code cache on as well, > should it be possible. :)
Technically it's possible I guess. Just no time to do it :) Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

George Schlossnagle

21 years ago
On Aug 13, 2005, at 8:19 AM, Derick Rethans wrote:
> On Fri, 12 Aug 2005, steve roussey wrote: > > >>> 4. Include an opcode cache by default. A lot of work has gone into >>> pecl/apc recently, but I am not hung up on which one goes in. >>> >> >> I have no karma to +1, but would if I could. It would be wonderful if >> something like xdebug could profile with op code cache on as well, >> should it be possible. :) >> > > Technically it's possible I guess. Just no time to do it :)
I had this working with apc and apd. If any opcode cache goes into the core, I'll happily work out interoperation with all the profilers. George

Ron Korving

21 years ago
Now I'm not the person with the kind of karma that should make you guys listen, but in case you are interested, I'll just add my 2 cents
> 1. Remove register_globals completely
+1
> 2. Remove magic_quotes_*
+1000
> 6. Remove some stuff that has been marked deprecated since PHP 3/4
+1
> A couple of others that we could consider, but I don't actually think > wins us much apart from academic purity (which I have never been all > that keen on) are: > > 7. Make identifiers case-sensitive
+1 Althought perhaps it could remain case-insensitive, but throwing a notice. This way users can decide for themselves if they wanna write neat code by using E_ALL. On the other hand, I assume case sensitivity would improve overall performance, while notices do the exact opposite.
> 8. Remove various function aliases
+1
> -Rasmus
Might I add a few requests: 9. Much improved __toString behavior (I doubt I'd need to clarify that) 10. Broader support for (custom) stream-wrappers (I noticed the zlib functions don't accept them). I wanted to make a stream wrapper for strings, so I could do this: readgzfile("str://andHereSomeGzipData").. In fact, if you ask me, such a str:// wrapper may be implemented as a standard wrapper. It would be useful in a lot more cases where functions read from files. 11. Altered/improved garbage collection (see my recent post on leaking memory when throwing exceptions from a foreach() loop). Leaking memory may be perfectly fine in a webserver situation, but I personally use PHP a lot for cli-scripts (sometimes forever-running daemon applications) and I'm sure a lot of other people do as well. 12. I hate to bring this up, don't shoot me for this, but ... multiple inheritance? ;) 13. A built-in code optimizer. Why should something like Zend optimizer be installed afterwards, if everybody can use increased performance? 14. Turn (all) fatal errors in extentions and the core into exceptions. Personally, I'd like to be able to catch and log all error situations, not just the ones I create myself. The exceptions should be of a specific custom exception class of course. If people don't catch the exceptions, the output would be pretty much as the same as fatal errors are right now anyway, so BC won't really be a problem. 15. Remove $HTTP_* (altho you may have included that when you thought of #6) and register_long_arrays. 16. Support for <?php="foo" ?> 17. A reliable non-bankers-round function 18. The ability to use an array() of constants in a define. Maybe I'll think of more later ;) Ron

Ron Korving

21 years ago
Oh, and I almost forgot one wishlist item I've had on my list for a long time (I hope you guys have an open mind)........ How about doubling integer precision to 64 bits and float/double precision to 128 bits? It's in line with 64 bit CPU capabilities, and personally, I wouldn't mind it a bit if it would make numerical processing in PHP slower on 32 bit systems. I think the advantages are much too great for that. If this is ever gonna happen, I think PHP6 would be great timing for it. It would make falling back to the slow string-based bc match functions a lot less common. Personally, I really like the idea of being able to count to 9223372036854775808 instead of 2147483648. Ron

Sara Golemon

21 years ago
> How about doubling integer precision to 64 bits and float/double precision > to 128 bits? It's in line with 64 bit CPU capabilities, and personally, I > wouldn't mind it a bit if it would make numerical processing in PHP slower > on 32 bit systems. I think the advantages are much too great for that. If > this is ever gonna happen, I think PHP6 would be great timing for it. >
If there were such a type as 'zend_long' used universally that might be at least possible (even configurable as a compile-time switch), but as it is *EVERYTHING* that touches a zval expects a long. On 32bit platforms that's a 32-bit number and there's no trivial way to change that. Athlon64s and Opterons are cheap nowadays anyway. I picked up a MB/CPU combo at Fry's last week for like $200. -Sara

Wez Furlong

21 years ago
We definitely need to start thinking forward and introduct a 64-bit type. It needn't replace the 32-bit type. IIRC, Andi promised that we would have this after 5.1, so I think it's a done deal. It's especially important now that we have a number of extensions returning 64-bit data. And with Visual Studio .Net 2005, time_t is now 64-bit (!?) --Wez. On 8/12/05, Sara Golemon <pollita@php.net> wrote:

Lukas Smith

21 years ago
Ron Korving wrote:
> 13. A built-in code optimizer. Why should something like Zend optimizer be > installed afterwards, if everybody can use increased performance?
IIRC George once played around with a few peekhole optimizations for APC. I think the performance improvements possible with peekhole optimizations are probably not that great in the real world. However its a kind of atttractive thought to have frequently accessed cached code in APC being optimized more aggressively the more the code is being uses. AFAIK the Zend Performance Suite (or whatever it is called today) does that. regards, Lukas

Lukas Smith

21 years ago
Ron Korving wrote:
> 16. Support for <?php="foo" ?>
that reminds me: set short_open_tags to off in any sample php.ini we ship. regards, Lukas

Jani Taskinen

21 years ago
On Sat, 13 Aug 2005, Lukas Smith wrote:
> Ron Korving wrote: > >> 16. Support for <?php="foo" ?> > > that reminds me: > > set short_open_tags to off in any sample php.ini we ship.
Ah yes, that reminds me: 17. Nuke every "alternative" open tag and only have <?php --Jani

Sara Golemon

21 years ago
>> set short_open_tags to off in any sample php.ini we ship. > > Ah yes, that reminds me: > > 17. Nuke every "alternative" open tag and only have <?php >
Agreed (though not so much nuke as default to off). Whenever open tags comes up, I'll toss <script language="php"> into the conversation and get nothing but doubtful stares. Is this used *anywhere* except academic examples? -Sara

Jani Taskinen

21 years ago
On Sat, 13 Aug 2005, Sara Golemon wrote:
>>> set short_open_tags to off in any sample php.ini we ship. >> >> Ah yes, that reminds me: >> >> 17. Nuke every "alternative" open tag and only have <?php >> > Agreed (though not so much nuke as default to off). > > Whenever open tags comes up, I'll toss <script language="php"> into the > conversation and get nothing but doubtful stares. Is this used *anywhere* > except academic examples?
I'd say "no", but I think some Zend boys use it since Stas (or someone else) raised a hell after some changes in this stuff not long ago.. ;) --Jani

Derick Rethans

21 years ago
On Sat, 13 Aug 2005, Sara Golemon wrote:
> > > set short_open_tags to off in any sample php.ini we ship. > > > > Ah yes, that reminds me: > > > > 17. Nuke every "alternative" open tag and only have <?php > > > Agreed (though not so much nuke as default to off). > > Whenever open tags comes up, I'll toss <script language="php"> into the > conversation and get nothing but doubtful stares. Is this used *anywhere* > except academic examples?
No idea, but it should go. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Jani Taskinen

21 years ago
On Fri, 12 Aug 2005, Rasmus Lerdorf wrote:
> 1. Remove register_globals completely
+1 (then we can cleanup the mess in ext/session too :)
> 2. Remove magic_quotes_*
+1 (definately, finally, at last! The filter stuff obsoletes those anyway?)
> 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default.
+1 (to be able to do 2. for real, of course)
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
+100 (it's ridiculous to have to install it separately)
> 5. Remove safe_mode and focus on open_basedir
+1
> 6. Remove some stuff that has been marked deprecated since PHP 3/4
Something like 'allow_call_time_pass_reference' or whatever it was again?
> A couple of others that we could consider, but I don't actually think > wins us much apart from academic purity (which I have never been all > that keen on) are: > > 7. Make identifiers case-sensitive
Such as function names? :) That'd be kinda nice since it not only makes the language more consistent but also tad faster, especially now with the unicode stuff slowing that down even more..
> 8. Remove various function aliases
I was toying with an idea about a configure switch and/or ini option. But I guess some of those just should go away. The other wild idea I got while thinking about this was to add opposite option for 'disable_functions', 'enable_functions', which would only enable the functions I _really_ use :) --Jani

Andrey Hristov

21 years ago
+1 from here too except 0 for the case sensitivity. Andrey Rasmus Lerdorf wrote:

Lukas Smith

21 years ago
+1 on all the mentioned items, except for case sensitivity for identifiers where I am -1 (I dont see the benefit). Aside from that I wouldnt mind an aggressive function name and parameter order clean up. We could provide a BC lib via runkit (or was it classkit .. I can never separate the two in my brain). Speaking of *kit .. how about sandboxing or some sort of taint model. regards, Lukas

Ryan King

21 years ago
On Aug 12, 2005, at 3:33 PM, Lukas Smith wrote:
> +1 on all the mentioned items, except for case sensitivity for > identifiers where I am -1 (I dont see the benefit). > > Aside from that I wouldnt mind an aggressive function name and > parameter order clean up. We could provide a BC lib via runkit (or > was it classkit .. I can never separate the two in my brain).
PHP_Compat[http://pear.php.net/package/php_compat] would be another alternative. -ryan

patrick müller

21 years ago
Lukas Smith wrote:
> Speaking of *kit .. how about sandboxing or some sort of taint model. >
i'd beg for that.

Marcus Börger

21 years ago
Hello Rasmus, Friday, August 12, 2005, 7:48:20 PM, you wrote:
> Since we are breaking a lot of stuff in 6.0, at least with > Unicode_semantics=On I am wondering if it may not be time to break some > more stuff and do a bit of spring cleaning. It would mean many apps > would need some work to work on PHP 6, but at the same time I think it > is work people would welcome since it would mostly involve removing > hacks instead of adding them. And yes, I know this is pretty > controversial, so take a few deep breaths before replying, please.
> 1. Remove register_globals completely
+1
> 2. Remove magic_quotes_*
+1
> 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default.
+1
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
+1
> 5. Remove safe_mode and focus on open_basedir
+1
> 6. Remove some stuff that has been marked deprecated since PHP 3/4
+1
> A couple of others that we could consider, but I don't actually think > wins us much apart from academic purity (which I have never been all > that keen on) are:
> 7. Make identifiers case-sensitive
+10
> 8. Remove various function aliases
~0
> -Rasmus
Very nice list. Very nice list. May i continue with a few additions of mine by order of importance? 9. __toString) everywhere, but i already said i'll take care of that unless i am being held back. So now go for that or live with the fact that php is meant to generate html pages which is text output. Thus sooner or later your objects create text simplifying that aas much as possible is at least to me mor ethan welcome. 10. namespace support (we are telling everyone php is ready for the big soup. In those scenarios you often find big teams and any help allowing things like dedicated responisbilities and preventing communication problems is more then welcome.) 11. class operator cleanup :: static -> non static this would allow to do more things like accessing static members/consts from anywhere a class is allowed etc. (if proposed that before incl. patch lookup the archieves). 12. {} vs [] cleanup 12a. using {} for strings could also bring us substr() functionality to {}. 13. eventually cleanup parameter order. Guys who knows in which functions the needle is first or second? My solution is to look up every function always which is a bit inefficient. I know the param order in c/C++ and sometimes in java but in php storing that info is impossible and useless so far. 14. i read drop gd1, nice one 15. i think of splitting dba, making ini-file into dba core and putting all but dba core into pecl (further plans for ini-file). 16. changing var_dump() et all to write out the class name for members since it is not helpfull at all if you see two members of the same name. Maybe it helps if one is private and the is not but still .... And i already treated "the operator which must not be named" for somethig else so there is no 17 here. Wow you made it till here. My favorites are actually: 7, 4, 3, 9, 10, 11, 1, 2, 5, 6, 12, 13, 14,15, 16 I consider most of the above actually as bugs: "Whipe them out *all* of them". Best regards, Marcus

Lukas Smith

21 years ago
Marcus Boerger wrote:
> 11. class operator cleanup > :: static > -> non static > this would allow to do more things like accessing static members/consts > from anywhere a class is allowed etc. (if proposed that before incl. patch > lookup the archieves).
could you elaborate what you mean with this .. currently (some?) "static" calls from within a method will still result in a non static method call ... like parent::fobar() are you talking about cleaning this up? also do you remember my complaints about the fact that static and inheritance dont mix well, since alot of things are done at compile time for performance reasons .. does this also fall into this topic? regards, Lukas

Marcus Börger

21 years ago
Hello Lukas, Saturday, August 13, 2005, 1:34:35 AM, you wrote:
> Marcus Boerger wrote:
>> 11. class operator cleanup >> :: static >> -> non static >> this would allow to do more things like accessing static members/consts >> from anywhere a class is allowed etc. (if proposed that before incl. >> patch lookup the archieves).
> could you elaborate what you mean with this ..
> currently (some?) "static" calls from within a method will still result > in a non static method call ... like parent::fobar()
> are you talking about cleaning this up?
static=static, non-static=non-static and no moe ZEND_ACC_ALLOW_STATIC
> also do you remember my complaints about the fact that static and > inheritance dont mix well, since alot of things are done at compile time > for performance reasons .. does this also fall into this topic?
well you could make your own oint in disallowing "if() class" or in other words allow class definitions only in the main block. If then you go for forward declarations also "class SomeClassName; /* no block after ; */" you'd gain a bit: - being able to use upcoming perl 6 compiler namely parrot (if someone wants to do the work). Full support with upcoming php idl compiler. But we have to hear about that from the author. - moving all inheritance to compile time - already a tiny bit of a spead increase - together with apc or some other cache another bit of a speed increase. On the contray you'd loose some flexibilty (not that i'd like it buut others do) and btw php is the only language in use i knwo of which is capable of this. best regards marcus

Ilia A.

21 years ago
Marcus Boerger wrote:
> 9. __toString) everywhere, but i already said i'll take care of that unless > i am being held back. So now go for that or live with the fact that php is > meant to generate html pages which is text output. Thus sooner or later your > objects create text simplifying that aas much as possible is at least to me > mor ethan welcome.
Can you clarify that?
> 10. namespace support (we are telling everyone php is ready for the big > soup. In those scenarios you often find big teams and any help allowing > things like dedicated responisbilities and preventing communication > problems is more then welcome.)
-1 before, -1 still.
> 12. {} vs [] cleanup
unicode support already makes such distinction it.
> 12a. using {} for strings could also bring us substr() functionality to {}.
One hand I like it, I think I even proposed things like $str{-1} at one time, on the other hand it creates a big WTF factor. Overall I'd say, -0.5
> 13. eventually cleanup parameter order. Guys who knows in which functions > the needle is first or second? My solution is to look up every function > always which is a bit inefficient. I know the param order in c/C++ and > sometimes in java but in php storing that info is impossible and useless so > far.
-1
> 15. i think of splitting dba, making ini-file into dba core and putting all > but dba core into pecl (further plans for ini-file).
+1 for pecl move, ~0 for the rest. Ilia

Andrei Zmievski

21 years ago
On Aug 12, 2005, at 11:29 PM, Ilia Alshanetsky wrote:
>> 12. {} vs [] cleanup >> > > unicode support already makes such distinction it.
No, it doesn't. That's one of the thorny unresolved issues. -Andrei

Ilia A.

21 years ago
I thought we've discussed making one access code-units and the other code-points? Ilia Andrei Zmievski wrote:

Andrei Zmievski

21 years ago
We did, but we never arrived at consensus. I don't really see a good reason for giving people access to code-units with such a low-level operator. If we fix it, I'd rather fix it so that [] only works on arrays, and {} on strings, with some sort of BC switch. -Andrei On Aug 12, 2005, at 11:47 PM, Ilia Alshanetsky wrote:

Ron Korving

21 years ago
What's bad about using [] for strings? I think people who come from a C-background (like myself) really like that syntax. I'd prefer it to stay the way it is. Ron "Andrei Zmievski" <andrei@gravitonic.com> wrote in message news:73D65ACE-D442-41FF-A35C-42D92F7B7A75@gravitonic.com...

Jani Taskinen

21 years ago
On Fri, 12 Aug 2005, Andrei Zmievski wrote:
> We did, but we never arrived at consensus. I don't really see a good reason > for giving people access to code-units with such a low-level operator. If we > fix it, I'd rather fix it so that [] only works on arrays, and {} on strings,
+100
> with some sort of BC switch.
-Inf We're talking about cleaning up legacy stuff, not creating new, aren't we? :) And iirc, using [] for strings has been "deprecated" for ages now. --Jani

Marcus Börger

21 years ago
Hello Jani, Sunday, August 14, 2005, 2:37:36 AM, you wrote:
> On Fri, 12 Aug 2005, Andrei Zmievski wrote:
>> We did, but we never arrived at consensus. I don't really see a good reason >> for giving people access to code-units with such a low-level operator. If we >> fix it, I'd rather fix it so that [] only works on arrays, and {} on strings,
> +100
>> with some sort of BC switch.
> -Inf
> We're talking about cleaning up legacy stuff, not creating new, aren't we? :) > And iirc, using [] for strings has been "deprecated" for ages now.
agreed totally, thanks and amen (hopefully) Best regards, Marcus

Andrei Zmievski

21 years ago
On Aug 13, 2005, at 5:37 PM, Jani Taskinen wrote:
> -Inf > > We're talking about cleaning up legacy stuff, not creating > new, aren't we? :) > And iirc, using [] for strings has been "deprecated" for ages > now.
Not really. [] and {} compile to exactly the same thing, actually. -Andrei

Derick Rethans

21 years ago
On Sat, 13 Aug 2005, Andrei Zmievski wrote:
> On Aug 13, 2005, at 5:37 PM, Jani Taskinen wrote: > > > -Inf > > > > We're talking about cleaning up legacy stuff, not creating new, aren't > > we? :) > > And iirc, using [] for strings has been "deprecated" for ages now. > > Not really. [] and {} compile to exactly the same thing, actually.
Might be true, but the manual lists this for years already: http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Marcus Börger

21 years ago
Hello Derick, Sunday, August 14, 2005, 12:47:46 PM, you wrote:
> On Sat, 13 Aug 2005, Andrei Zmievski wrote:
>> On Aug 13, 2005, at 5:37 PM, Jani Taskinen wrote: >> >> > -Inf >> > >> > We're talking about cleaning up legacy stuff, not creating new, aren't >> > we? :) >> > And iirc, using [] for strings has been "deprecated" for ages now. >> >> Not really. [] and {} compile to exactly the same thing, actually.
> Might be true, but the manual lists this for years already:
> http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex
So if we stick to the docs then [] == arrays, {} == strings and we're happy. Best regards, Marcus

Andrei Zmievski

21 years ago
Then we should fix one or the other. -Andrei On Aug 14, 2005, at 3:47 AM, Derick Rethans wrote:

Derick Rethans

21 years ago
On Sat, 13 Aug 2005, Ilia Alshanetsky wrote:
> I thought we've discussed making one access code-units and the other > code-points?
And the reason why I want this is speed. [1231231] vs. {1231231}, having the first one access codeunits would be quite a lot faster as not the whole string has to be scanned for every usage of {}. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Andrei Zmievski

21 years ago
So, you'd rather have PHP users gain some speed at the expense of having to check for surrogates everywhere? -Andrei On Aug 13, 2005, at 5:23 AM, Derick Rethans wrote:

Derick Rethans

21 years ago
On Sat, 13 Aug 2005, Andrei Zmievski wrote:
> So, you'd rather have PHP users gain some speed at the expense of having to > check for surrogates everywhere?
In quite some cases for me i'm sure there are no surrogates in the text I'm parsing. Having to deal with rescanning the string for every access to a character is not really wanted. Derick

Andrei Zmievski

21 years ago
Then why don't we put our collective brains together and think of a solution for this that does not involve hacks? -Andrei On Aug 14, 2005, at 3:51 AM, Derick Rethans wrote:

l0t3k

21 years ago
Back in the early days of the extension, i had a request global ICUG(codepoint_semantics) which controlled this. Setting this to false would revert to code-unit indexing (which ICU does internally). clayton "Andrei Zmievski" <andrei@gravitonic.com> wrote in message news:133A42C8-184B-49F3-8EEA-3B595B4BD062@gravitonic.com...

David Zülke

21 years ago
> > 10. namespace support (we are telling everyone php is ready for the big > > soup. In those scenarios you often find big teams and any help allowing > > things like dedicated responisbilities and preventing communication > > problems is more then welcome.) > > -1 before, -1 still.
Well... if you're so anti-namespaces, I'm sure you will change all my code to use different names when collisions occur, right? Thanks man, saves me loads of trouble then. - David

Jani Taskinen

21 years ago
On Sat, 13 Aug 2005, David Zülke wrote:
>>> 10. namespace support (we are telling everyone php is ready for the big >>> soup. In those scenarios you often find big teams and any help allowing >>> things like dedicated responisbilities and preventing communication >>> problems is more then welcome.) >> >> -1 before, -1 still. > > Well... if you're so anti-namespaces, I'm sure you will change all my code > to use different names when collisions occur, right? Thanks man, saves me > loads of trouble then.
# perl -p -i -e 's/stupidclassnamewithoutproperprefix/good_classname/g' *.php That wasn't so hard, was it? :) (that's basically only thing I use perl for :) --Jani

George Schlossnagle

21 years ago
On Aug 13, 2005, at 2:29 AM, Ilia Alshanetsky wrote:
> Marcus Boerger wrote: > >> 9. __toString) everywhere, but i already said i'll take care of >> that unless >> i am being held back. So now go for that or live with the fact >> that php is >> meant to generate html pages which is text output. Thus sooner or >> later your >> objects create text simplifying that aas much as possible is at >> least to me >> mor ethan welcome.
+1. Either that or just drop __toString altogether. Right now it's about worse than useless, as it's hard to understand exactly when it will and won't be called.
>> 10. namespace support (we are telling everyone php is ready for >> the big >> soup. In those scenarios you often find big teams and any help >> allowing >> things like dedicated responisbilities and preventing communication >> problems is more then welcome.) >> > > -1 before, -1 still.
A big +1 for namespaces, -1 for namespacing existing internal functions (or somehow importing them by default so that they can be referenced by their current name.
>> 13. eventually cleanup parameter order. Guys who knows in which >> functions >> the needle is first or second? My solution is to look up every >> function >> always which is a bit inefficient. I know the param order in c/C++ >> and >> sometimes in java but in php storing that info is impossible and >> useless so >> far. >> > > -1
-1 George

Rui Hirokawa

21 years ago
+1 bundling the opcode cache like APC. I also wish some elemental debugging features (stack dump, etc.) like Xdebug has. Rui On Fri, 12 Aug 2005 10:48:20 -0700 Rasmus Lerdorf <rasmus@lerdorf.com> wrote:
> Since we are breaking a lot of stuff in 6.0, at least with > Unicode_semantics=On I am wondering if it may not be time to break some > more stuff and do a bit of spring cleaning. It would mean many apps > would need some work to work on PHP 6, but at the same time I think it > is work people would welcome since it would mostly involve removing > hacks instead of adding them. And yes, I know this is pretty > controversial, so take a few deep breaths before replying, please.
-- Rui Hirokawa <rui_hirokawa@ybb.ne.jp> -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.8/71 - Release Date: 2005/08/12

Ondrej Ivanič

21 years ago
Hi
> 1. Remove register_globals completely > > 2. Remove magic_quotes_* > > 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default. > > 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in. > > 5. Remove safe_mode and focus on open_basedir > > 6. Remove some stuff that has been marked deprecated since PHP 3/4 > > A couple of others that we could consider, but I don't actually think > wins us much apart from academic purity (which I have never been all > that keen on) are: > > 7. Make identifiers case-sensitive > > 8. Remove various function aliases
+1 to all things here. 9. Shared memory storage for variables with transparent access. (superglobal array?)
-- Ondrej Ivanic (ondrej@kmit.sk)

George Schlossnagle

21 years ago
On Aug 13, 2005, at 5:08 AM, Ondrej Ivanič wrote:
> > 9. Shared memory storage for variables with transparent access. > (superglobal array?)
-1. This is hard to make consistent across all platforms, and will break instantly when you go past 1 machine, making it confusing and of marginal usage. George

Jani Taskinen

21 years ago
On Sat, 13 Aug 2005, George Schlossnagle wrote:
> > On Aug 13, 2005, at 5:08 AM, Ondrej Ivani wrote: >> >> 9. Shared memory storage for variables with transparent access. (superglobal >> array?) > > -1. This is hard to make consistent across all platforms, and will break > instantly when you go past 1 machine, making it confusing and of marginal > usage.
Maybe this could be something that ext/session could provide. I sure can find some uses for a 'global session'. --Jani

George Schlossnagle

21 years ago
On Aug 13, 2005, at 9:06 PM, Jani Taskinen wrote:
> On Sat, 13 Aug 2005, George Schlossnagle wrote: > > >> >> On Aug 13, 2005, at 5:08 AM, Ondrej Ivani wrote: >> >>> 9. Shared memory storage for variables with transparent access. >>> (superglobal array?) >>> >> >> -1. This is hard to make consistent across all platforms, and >> will break instantly when you go past 1 machine, making it >> confusing and of marginal usage. >> > > Maybe this could be something that ext/session could provide. > I sure can find some uses for a 'global session'.
That seems like a reasonable to go. I question it's utility a bit - how often is this really useful? For large objects (like a real cache), this isn't the best place to store it, for most resources it won't work at all. So what's a typical use case for this? George

Jani Taskinen

21 years ago
On Sat, 13 Aug 2005, George Schlossnagle wrote:
>> Maybe this could be something that ext/session could provide. >> I sure can find some uses for a 'global session'. > > That seems like a reasonable to go. I question it's utility a bit - how often > is this really useful? For large objects (like a real cache), this isn't the > best place to store it, for most resources it won't work at all. So what's a > typical use case for this?
I wasn't even dreaming of using it for storing stuff like objects in it. As a real world example, I'd use something like that for "locking" stuff in the admin interface, e.g. when someone opens an item for editing, it's locked for all other moderators/administrators/etc... Of course I can accomplish that by a separate table in the database, but I'd like to avoid any unnecessary writes to DB whenever possible. :) Anyone have any other solutions to this (I'd guess quite common problem) I'm open for suggestions. :) Some other uses for a "global session" might be forums and their 'show online users' feature. --Jani

Ilia A.

21 years ago
If apc comes bundled then it includes apc_store() and apc_fetch() this is pretty much $_MEMORY with a few tweaks. Ilia

Jani Taskinen

21 years ago
On Sun, 14 Aug 2005, Ilia Alshanetsky wrote:
> If apc comes bundled then it includes apc_store() and apc_fetch() this > is pretty much $_MEMORY with a few tweaks.
Yes, but that is restricted to one server installations. I need such a 'global session' that is available with multiple front-end servers..ie. using DB as session storage. --Jani

Rasmus Lerdorf

21 years ago
Jani Taskinen wrote:
> On Sun, 14 Aug 2005, Ilia Alshanetsky wrote: > >> If apc comes bundled then it includes apc_store() and apc_fetch() this >> is pretty much $_MEMORY with a few tweaks. > > > Yes, but that is restricted to one server installations. > I need such a 'global session' that is available with multiple > front-end servers..ie. using DB as session storage.
I am confused. What are you proposing here? That we write a multi-server memory-based datastore? That's a project in itself and quite beyond the scope of PHP. It would seem to me like a replicated database setup with decent query caching solves this problem nicely. -Rasmus

Marc Richards

21 years ago
Rasmus Lerdorf wrote:
> Jani Taskinen wrote: > >>On Sun, 14 Aug 2005, Ilia Alshanetsky wrote: >> >> >>>If apc comes bundled then it includes apc_store() and apc_fetch() this >>>is pretty much $_MEMORY with a few tweaks. >> >> >> Yes, but that is restricted to one server installations. >> I need such a 'global session' that is available with multiple >> front-end servers..ie. using DB as session storage. > > > I am confused. What are you proposing here? That we write a > multi-server memory-based datastore? That's a project in itself and > quite beyond the scope of PHP. It would seem to me like a replicated > database setup with decent query caching solves this problem nicely. > > -Rasmus
How about an implementation with multiple possible backends ala session.save_handler? It could use "files" or "apc" by default, or optionally use something like "mm", "msession" or "mysql" depending on the user's needs. Marc

Gareth Ardron

21 years ago
Jani Taskinen wrote:
> On Sun, 14 Aug 2005, Ilia Alshanetsky wrote: > >> If apc comes bundled then it includes apc_store() and apc_fetch() this >> is pretty much $_MEMORY with a few tweaks. > > > Yes, but that is restricted to one server installations. > I need such a 'global session' that is available with multiple > front-end servers..ie. using DB as session storage.
True enough, but surely good enough for a number of users to use. The fact that you need central session storage because (I'm guessing here) your frontends are behind a handful of load balancers is something which, well, lets face it - is pretty rare as far as the average users experiance goes. Just my 2c.

Ondrej Ivanič

21 years ago
Jani Taskinen wrote:
>> If apc comes bundled then it includes apc_store() and apc_fetch() this >> is pretty much $_MEMORY with a few tweaks. > > > Yes, but that is restricted to one server installations. > I need such a 'global session' that is available with multiple > front-end servers..ie. using DB as session storage.
It's a feature, not a bug :) At this moment I playing with daemon which receive messages from network (broadcast/multicast) and store it to shmem segment. PHP scripts only reads this data.
-- Ondrej Ivanic (ondrej@kmit.sk)

George Schlossnagle

21 years ago
On Aug 14, 2005, at 3:37 PM, Jani Taskinen wrote:
> On Sun, 14 Aug 2005, Ilia Alshanetsky wrote: > > >> If apc comes bundled then it includes apc_store() and apc_fetch() >> this >> is pretty much $_MEMORY with a few tweaks. >> > > Yes, but that is restricted to one server installations. > I need such a 'global session' that is available with multiple > front-end servers..ie. using DB as session storage.
ext/session has the framework for doing this. I concur with your original idea of augmenting it to provide those services. Perhaps a new autoglobal $_GLOBAL_SESSION[]. Thoughts? George

Jason Sweat

21 years ago
On 8/14/05, George Schlossnagle <george@omniti.com> wrote:
> > On Aug 14, 2005, at 3:37 PM, Jani Taskinen wrote: > > > On Sun, 14 Aug 2005, Ilia Alshanetsky wrote: > > > > > >> If apc comes bundled then it includes apc_store() and apc_fetch() > >> this > >> is pretty much $_MEMORY with a few tweaks. > >> > > > > Yes, but that is restricted to one server installations. > > I need such a 'global session' that is available with multiple > > front-end servers..ie. using DB as session storage. > > ext/session has the framework for doing this. I concur with your > original idea of augmenting it to provide those services. Perhaps a > new autoglobal $_GLOBAL_SESSION[]. Thoughts? > > George
IIRC, ages ago when I used ASP pages there as an "Application" object which was basically identical to this concept. I seem to recall using it for configuration kinds of thing (db connections, etc). I have resorted to caching for similar needs in PHP, I think $_GLOBAL_SESSION would be welcome addition, perhaps even allowing for customs session handlers similar to the $_SESSION now for multi-processor environments and other unique setup problems. Regards, Jason http://blog.casey-sweat.us/

Jani Taskinen

21 years ago
On Sun, 14 Aug 2005, George Schlossnagle wrote:
> > On Aug 14, 2005, at 3:37 PM, Jani Taskinen wrote: > >> On Sun, 14 Aug 2005, Ilia Alshanetsky wrote: >> >> >>> If apc comes bundled then it includes apc_store() and apc_fetch() this >>> is pretty much $_MEMORY with a few tweaks. >>> >> >> Yes, but that is restricted to one server installations. >> I need such a 'global session' that is available with multiple >> front-end servers..ie. using DB as session storage. > > ext/session has the framework for doing this. I concur with your original > idea of augmenting it to provide those services. Perhaps a new autoglobal > $_GLOBAL_SESSION[]. Thoughts?
<?php <the usual pre-session_start() things here..> session_set_application_id('someid'); session_start(); $_SESSION['foobar'] = 'foo'; $_GLOBAL['someid'] = 'bar'; etc. ?> Thanks to Marc for mentioning the application id. :) It should propably behave so that if the application id is not set, then we won't init the $_GLOBAL at all. --Jani

Christian Schneider

21 years ago
Rasmus Lerdorf wrote:
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
Big +1 9. Named parameters. Preferred way would be via array()-less array collation as we are already using this in our production system ;-) : foo('id' => 42, 'name' => "foo"); 10. Allow dangling commas in function calls, handy with varargs and 9: foo(1, 2, 3,); Minor: 11. HTTP response splitting attack protection: Replace \r and \n with space in header(); Information and patches implementing this can be found at http://cschneid.com/php/ - Chris

Stefan Esser

21 years ago
Hello,
> > Minor: > 11. HTTP response splitting attack protection: Replace \r and \n with > space in header(); > > Information and patches implementing this can be found at > http://cschneid.com/php/
Your patches are problematic when a proxy kills overlong header lines that were not split up by the client onto multiple lines. Therefore \r\n followed by whitespace should not be replaced with spaces..Otherwise this could destroy legit functionality. A similiar patch for this is in Hardening-Patch above 0.3.x Ohh and btw: this is not a minor point, because it completely kills the whole attack class for PHP applications with 3-5 lines of code. Stefan Esser
-- -------------------------------------------------------------------------- Stefan Esser sesser@php.net Hardened-PHP Project http://www.hardened-php.net/ GPG-Key gpg --keyserver pgp.mit.edu --recv-key 0x15ABDA78 Key fingerprint 7806 58C8 CFA8 CE4A 1C2C 57DD 4AE1 795E 15AB DA78 --------------------------------------------------------------------------

Ilia A.

21 years ago
How about we do this: Add a 3rd optional param to header(), if it is unset we remove everything from a header that contains \r\n or \n after those chars. However if the developer feels the need to send multiple headers or what not they can pass 3rd arg as TRUE and "restore" the functionality. Ilia Stefan Esser wrote:

Stefan Esser

21 years ago
Hello Ilia, if you look at the implementation of header() you will realise that sending multiple headers is actually already abusing how it was designed to work. Because the internal checks for double headers etc. do not work at all when you send multiple headers. Stefan

Ilia A.

21 years ago
I am a bit reluctant to remove the old "functionality" outright, hence the optional flag. Either way it seems better then what we've got right now. Ilia Stefan Esser wrote:

Andrey Hristov

21 years ago
Christian Schneider wrote:
> Rasmus Lerdorf wrote: > >> 4. Include an opcode cache by default. A lot of work has gone into >> pecl/apc recently, but I am not hung up on which one goes in. > > > Big +1 > > 9. Named parameters. Preferred way would be via array()-less array > collation as we are already using this in our production system ;-) : > foo('id' => 42, 'name' => "foo");
s + 0.5
> 10. Allow dangling commas in function calls, handy with varargs and 9: > foo(1, 2, 3,);
-1 . function calls
> Minor: > 11. HTTP response splitting attack protection: Replace \r and \n with > space in header(); > > Information and patches implementing this can be found at > http://cschneid.com/php/ > > - Chris >
Andrey

Matthew Weier O'Phinney

21 years ago
* Christian Schneider <cschneid@cschneid.com> :
> 9. Named parameters. Preferred way would be via array()-less array > collation as we are already using this in our production system ;-) : > foo('id' => 42, 'name' => "foo");
+1 -- this is one of the biggest things I miss coming from perl to PHP.
-- Matthew Weier O'Phinney Zend Certified Engineer http://weierophinney.net/matthew/

Ron Korving

21 years ago
Perhaps the named parameters could even be constant-like? How would this syntax be? foo(id => 42, name => "foo"); Ron "Matthew Weier O'Phinney" <mweierophinney@gmail.com> wrote in message news:slrndfs5ef.rck.mweierophinney@ubergeek.garden.org...

George Schlossnagle

21 years ago
On Aug 13, 2005, at 11:46 AM, Matthew Weier O'Phinney wrote:
> * Christian Schneider <cschneid@cschneid.com> : > >> 9. Named parameters. Preferred way would be via array()-less array >> collation as we are already using this in our production system ;-) : >> foo('id' => 42, 'name' => "foo"); >> > > +1 -- this is one of the biggest things I miss coming from perl to > PHP.
Huh? Perl doesn't have true support for this anyway, just a simpler syntax for hashrefs. If you want Perlish named params this is 100% identical to doing foo(array('id' => 42, 'name' => 'foo')); George

Andrey Hristov

21 years ago
George Schlossnagle wrote:
> > On Aug 13, 2005, at 11:46 AM, Matthew Weier O'Phinney wrote: > >> * Christian Schneider <cschneid@cschneid.com> : >> >>> 9. Named parameters. Preferred way would be via array()-less array >>> collation as we are already using this in our production system ;-) : >>> foo('id' => 42, 'name' => "foo"); >>> >> >> +1 -- this is one of the biggest things I miss coming from perl to PHP. > > > Huh? Perl doesn't have true support for this anyway, just a simpler > syntax for hashrefs. If you want Perlish named params this is 100% > identical to doing > > foo(array('id' => 42, 'name' => 'foo')); > > George >
Well, this idea I think comes from Python. Last time I checked they had these and as far as I remember this have been brought 2 times. The first time before 5.0 and has been rescheduled for 6.0 :) Andrey

George Schlossnagle

21 years ago
On Aug 13, 2005, at 5:49 PM, Andrey Hristov wrote:
> George Schlossnagle wrote: > >> On Aug 13, 2005, at 11:46 AM, Matthew Weier O'Phinney wrote: >> >>> * Christian Schneider <cschneid@cschneid.com> : >>> >>> >>>> 9. Named parameters. Preferred way would be via array()-less array >>>> collation as we are already using this in our production >>>> system ;-) : >>>> foo('id' => 42, 'name' => "foo"); >>>> >>>> >>> >>> +1 -- this is one of the biggest things I miss coming from perl >>> to PHP. >>> >> Huh? Perl doesn't have true support for this anyway, just a >> simpler syntax for hashrefs. If you want Perlish named params >> this is 100% identical to doing >> foo(array('id' => 42, 'name' => 'foo')); >> George >> > > Well, this idea I think comes from Python. Last time I checked they > had these > and as far as I remember this have been brought 2 times. The first > time before > 5.0 and has been rescheduled for 6.0 :)
:) I'm not against named parameters. Python's support for them is nice as well. But Perl doesn't support named parameters any different than can be done currently in PHP. George

Andrey Hristov

21 years ago
George Schlossnagle wrote:
> > On Aug 13, 2005, at 5:49 PM, Andrey Hristov wrote: > >> George Schlossnagle wrote: >> >>> On Aug 13, 2005, at 11:46 AM, Matthew Weier O'Phinney wrote: >>> >>>> * Christian Schneider <cschneid@cschneid.com> : >>>> >>>> >>>>> 9. Named parameters. Preferred way would be via array()-less array >>>>> collation as we are already using this in our production system ;-) : >>>>> foo('id' => 42, 'name' => "foo"); >>>>> >>>>> >>>> >>>> +1 -- this is one of the biggest things I miss coming from perl to >>>> PHP. >>>> >>> Huh? Perl doesn't have true support for this anyway, just a >>> simpler syntax for hashrefs. If you want Perlish named params this >>> is 100% identical to doing >>> foo(array('id' => 42, 'name' => 'foo')); >>> George >>> >> >> Well, this idea I think comes from Python. Last time I checked they >> had these >> and as far as I remember this have been brought 2 times. The first >> time before >> 5.0 and has been rescheduled for 6.0 :) > > > :) > > I'm not against named parameters. Python's support for them is nice as > well. But Perl doesn't support named parameters any different than can > be done currently in PHP. > > George >
I could be wrong, but I think you were the one who first wanted named parameters that long time ago :) Andrey

George Schlossnagle

21 years ago
On Aug 13, 2005, at 5:57 PM, Andrey Hristov wrote:
> George Schlossnagle wrote: > >> On Aug 13, 2005, at 5:49 PM, Andrey Hristov wrote: >> >>> George Schlossnagle wrote: >>> >>> >>>> On Aug 13, 2005, at 11:46 AM, Matthew Weier O'Phinney wrote: >>>> >>>> >>>>> * Christian Schneider <cschneid@cschneid.com> : >>>>> >>>>> >>>>> >>>>>> 9. Named parameters. Preferred way would be via array()-less >>>>>> array >>>>>> collation as we are already using this in our production >>>>>> system ;-) : >>>>>> foo('id' => 42, 'name' => "foo"); >>>>>> >>>>>> >>>>>> >>>>> >>>>> +1 -- this is one of the biggest things I miss coming from >>>>> perl to PHP. >>>>> >>>>> >>>> Huh? Perl doesn't have true support for this anyway, just a >>>> simpler syntax for hashrefs. If you want Perlish named params >>>> this is 100% identical to doing >>>> foo(array('id' => 42, 'name' => 'foo')); >>>> George >>>> >>>> >>> >>> Well, this idea I think comes from Python. Last time I checked >>> they had these >>> and as far as I remember this have been brought 2 times. The >>> first time before >>> 5.0 and has been rescheduled for 6.0 :) >>> >> :) >> I'm not against named parameters. Python's support for them is >> nice as well. But Perl doesn't support named parameters any >> different than can be done currently in PHP. >> George >> > > I could be wrong, but I think you were the one who first wanted > named parameters > that long time ago :)
Possibly, which would fall inline with not being against them now. :) I like them in Python. The ones in Perl are a hack, though, with limitations on how they can be positioned, lack of prototyping and default values, etc. The Python ones are much more flexible, imho. The only difference between Perl's support for named params and PHP's current support is that in Perl: foo( a => 1, b => 2) is the same as foo((a => 1, b => 2)), i.e. that you have in Perl: (a => 1, b => 2) whereas in PHP we have array('a' => 1, 'b' => 2);
> > Andrey >
George Schlossnagle -- Vice President of Engineering -- OmniTI Computer Consulting -- http://www.omniti.com

Joseph Crawford

21 years ago
I would like to see the Type Hinting expanded in PHP 6. In 5 now you can do class Test { public function testDatabase( Database $db ) { } } what if i wanted to make sure it was a String, Integer, Boolean, Float, etc.. i would like to see that added to the type hinting ;)
-- Joseph Crawford Jr. Codebowl Solutions, Inc. 1-802-671-2021 codebowl@gmail.com

Emil Hernvall

21 years ago
Talking about type hinting. It would be nice to be able to declare variables as a certain type once and for all (like c, although optional). I don't if this has been discussed and dismissed before, and if that is the case, please don't kill me. You're just brainstorming anyway, right? :) Emil

Marcus Börger

21 years ago
Hello Joseph, Sunday, August 14, 2005, 12:31:42 AM, you wrote:
> I would like to see the Type Hinting expanded in PHP 6. In 5 now you can do
> class Test {
> public function testDatabase( Database $db ) {
> } > }
> what if i wanted to make sure it was a String, Integer, Boolean, Float, > etc.. i would like to see that added to the type hinting ;)
we often enough decided against that (for the most we don't want to be another language like java). Best regards, Marcus

Derick Rethans

21 years ago
On Sat, 13 Aug 2005, Joseph Crawford wrote:
> what if i wanted to make sure it was a String, Integer, Boolean, Float, > etc.. i would like to see that added to the type hinting ;)
This is not going to happen. We've discussed this plenty of times before. Derick

Christian Schneider

21 years ago
George Schlossnagle wrote:
> Huh? Perl doesn't have true support for this anyway, just a simpler > syntax for hashrefs. If you want Perlish named params this is 100% > identical to doing > foo(array('id' => 42, 'name' => 'foo'));
If you are using this a lot then syntactic sugar does make a difference IMHO. That's why we decided to use a patch to allow foo('id' => 42, 'name' => "foo"); I agree that a fancier way would be to have something like function foo($id = 42) { ... } ... foo(id: 64738, name: "foo"); and then access them through $_PARAM['id'] (or $id because the function definition declares $id) and $PARAM['name'] respectively. What I don't like about Python at all is that AFAIK you can't call a method with parameters not declared in the function definition. That's a very handy feature for things like DB actions or HTML generation. Missing from the fancier version: Parameter names which aren't valid identifiers and preparing an array with values before calling a function. The first is a more hypothetical limitation as fields/attributes are normally not containing non-identifier characters but the second is a bit more practical: $record->insert('id' => 42, 'name' => "foo"); works just as well as $tags = array('id' => 42, 'name' => "foo"); ... # Add more key/values to $tags $record->insert($tags); without requiring insert() to distinguish between the two. If someone can come up with an elegant way to populate $_PARAM on a function call then both these limitations would be gone. That's it about named parameters from my side for now, - Chris

Christian Schneider

21 years ago
Christian Schneider wrote:
> What I don't like about Python at all is that AFAIK you can't call a > method with parameters not declared in the function definition.
Oops, Python does allow this with a *parameter or **parameter. Missed that part when reading the specs :-) - Chris

Ron Korving

21 years ago
"Christian Schneider" <cschneid@cschneid.com> wrote in message news:42FE85AA.6020309@cschneid.com...
> foo(id: 64738, name: "foo");
Oh, I love that syntax ;) Ron

Peter Brodersen

21 years ago
Hi, On Fri, 12 Aug 2005 10:48:20 -0700, in php.internals rasmus@lerdorf.com (Rasmus Lerdorf) wrote:
>Since we are breaking a lot of stuff in 6.0, at least with >Unicode_semantics=On I am wondering if it may not be time to break some >more stuff and do a bit of spring cleaning. It would mean many apps >would need some work to work on PHP 6, but at the same time I think it >is work people would welcome since it would mostly involve removing >hacks instead of adding them. And yes, I know this is pretty >controversial, so take a few deep breaths before replying, please.
I know this is just a wish list, and it wouldn't be constructive to go into implementation details. As you said, this is cleanup where some eggs will have to break. FWIW, as many others, I'm mainly positive about all the changes. Not surprisingly there would be a bunch of work regarding the information to end users. This might require some political decisions on what to recommend, when "features" are removed from users. I'll go into details here:
>1. Remove register_globals completely > >2. Remove magic_quotes_*
I'm all for. It would be nice, though, to provide users with details on how to do it "the right way" regarding database queries. Even though there are a lot of ways of doing it (manually call mysql_real_escape_string, use PEAR DB, use another API, etc.)., it might be nice to show users a simple way of doing stuff. I really like the perl DBI which is the de facto way of doing database work. I believe that lots of stuff that DBI (and PEAR DB and other DB abstraction layers) provide is helpful. Crafting and concatenating a query string really is a mess. On one hand this might have nothing to do with the tools and more on recommendations on how to code. It might not be the job of the PHP team to teach users how to code or recommend specific ways to code (think of all the OOP- and exception handling-discussions). Furthermore people might have different views on what API to use. I like PEAR DB because it is widely used, but as an example I don't like the chicken-and-the-egg problem (DB_common only gets read when DB::Connect has been called and loaded, så DB_common can't be extended). The point is mainly that it would be hard to recommend one way of doing things now (and it might be a political decision as well). On the other hand, people will be in demand of "how-to-convert"-information in the transitional phase. And if we really are doing a spring cleanup, we might consider doing it on the users as well :-)
>3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default.
This might go in hand with the first two wishes. It would be nice to make it easy for users who write php code that are going to be distributed world wide on different configurations without going into hundreds of different checks (such as "if (get_magic_quotes_gpc()) { .. }" ).
>5. Remove safe_mode and focus on open_basedir
I think a lot of work would have to go into this. Currently <warning type="pet peeve"> it could partially be circumvented using glob, e.g. print_r(glob("{/home/currentuser/,/etc}/*",GLOB_BRACE)); or error harvesting ("File(/tmp/sess_1234567890) is not within the allowed path(s)") </warning> I'm not sure whether or not this is regarded as a problem. These issues have been dismissed on the bugs list and I haven't heard anything from security@. Another type of default session handler might also be nice without direct mapping of file names and session ids - e.g. hashed values and addition of hashed SERVER_NAME where available. Regarding the way users code (as mentioned in #3), we also see that when notices were enabed and widespread on installations, e.g.: if ($_REQUEST['foo'] == ...) .. users just changed their code to: if (isset($_REQUEST['foo']) && $_REQUEST['foo'] == ...) I don't think this is particular more nice code, but just a recurring pattern every time a variable from the outside is submitted. This is a really wild idea, but how about retrieving external variables using functions instead? The idea is that external data isn't variables per default and could be referenced without throwing notices, e.g.: if (getuserdata('foo') == ...) Of course I'm not against notices, but I think there is a clear distinction (or should be...) between stuff that might exist beyond our control (user-submitted data) and stuff that we rely on (own variables). But all in all: very exciting. As mentioned, there really might be a lot of work regarding the information and transitional help if all these wishes come true.
-- - Peter Brodersen

Jochem Maas

21 years ago
for what its worth - brilliant :-) aftering reading the remarks about perl6 (love the idea of you guys winning that 'race' :-) I did a little reading, seems perl6 is aimed to target Parrot... I remember there was discussion about this for php, don't know if the idea died a lonely death or was just put in the deepfreeze - maybe it's something to consider? Rasmus Lerdorf wrote:

Aaron Wormus

21 years ago
Rasmus Lerdorf wrote:
>Since we are breaking a lot of stuff in 6.0, at least with >Unicode_semantics=On I am wondering if it may not be time to break some >more stuff and do a bit of spring cleaning. It would mean many apps >would need some work to work on PHP 6, but at the same time I think it >is work people would welcome since it would mostly involve removing >hacks instead of adding them. And yes, I know this is pretty >controversial, so take a few deep breaths before replying, please. >
How about allowing mod_php6 to run alongside mod_php? Provide an easy way for the hosting people to provide PHP6 without breaking everything. Aaron

Pasha Zubkov

21 years ago
Aaron Wormus wrote:
> How about allowing mod_php6 to run alongside mod_php? Provide an easy > way for the hosting people to provide PHP6 without breaking everything. > > Aaron >
It's very good idea ;) 6.0 is a major release, so it can break many things, and with mod_php6 it can not worring about BC at all. I'm only php user, not developer, but +1 from me.

Zeev Suraski

21 years ago
At 20:48 12/08/2005, Rasmus Lerdorf wrote:
>Since we are breaking a lot of stuff in 6.0, at least with >Unicode_semantics=On I am wondering if it may not be time to break some >more stuff and do a bit of spring cleaning. It would mean many apps >would need some work to work on PHP 6, but at the same time I think it >is work people would welcome since it would mostly involve removing >hacks instead of adding them. And yes, I know this is pretty >controversial, so take a few deep breaths before replying, please.
First of all, in general - I don't subscribe to the school of 'we broke something, why not break more'. With every feature we break, we reduce the chances of people upgrading, of legacy apps working, and we reduce the overall success chances of the new version. Compatibility breakup is not binary, it accumulates. The more features are broken, the worse the situation becomes.
>1. Remove register_globals completely > >2. Remove magic_quotes_*
Given what I said above, I don't see any motivation to remove register_globals or magic_quotes. I don't see how it buys us anything other than pissed off users and hordes of (sometimes exploitable) bugs that will result from sloppy audits. These changes alone would mean that a great deal of the applications would have to be 100% audited before an upgrade. Between us, developers welcoming forced labor due to upgrades is wishful thinking. People never like to be forced to go over their or other people's code regardless of the circumstances. If we are to do anything about register_globals, perhaps we can change the name of the directive to something else (e.g. unprotected_globals), and of course keep its default 0. Admins will have to make an informed decision to turn it on again, and we can speak against it as strongly as we want in an upgrade guide. Change the default of magic_quotes_gpc to 0 as well.
>3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default.
Sounds good.
>4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
Need to think about that one.
>5. Remove safe_mode and focus on open_basedir
Sounds good.
>6. Remove some stuff that has been marked deprecated since PHP 3/4 > >A couple of others that we could consider, but I don't actually think >wins us much apart from academic purity (which I have never been all >that keen on) are: > >7. Make identifiers case-sensitive > >8. Remove various function aliases
As I'm sure you'd agree, academic purity is not exactly why PHP won the hearts of the masses. I would almost argue the opposite. Features which only bother us due to academic purity are clearly ones we shouldn't touch. Even more so than register_globals and magic_quotes - which are not only impure but also problematic - there's no point forcing people to modify their code just because we feel like making PHP more academically pure. Other than creating a huge worldwide mess and slowing down migration, we're not going to gain anything (assuming we don't get any points for academic purity; PHP scored 100 when handed in as an academic project, by the way :). Even if we forget about the users, and only think about ourselves - unless something drastic happens, we're going to look at supporting 4 major different versions simultaneously - 4.3/4.4, 5.0, 5.1 and 6.0. Is it really such a great idea to start breaking compatibility beyond what we absolutely have to? I think you have some good ideas in that list, and some less good ideas. I'm worried about the wholesale mode that internals@ switched into, the almost unanimous "YES!" response, and the overall feeling that suddenly with 6.0 breakage comes without a price. That goes counter to our key design goals in the Unicode support, which were work-as-if-nothing-happened when unicode support is disabled. Zeev

mbneto

21 years ago
Hi,
> > First of all, in general - I don't subscribe to the school of 'we broke > something, why not break more'. With every feature we break, we reduce the > chances of people upgrading, of legacy apps working, and we reduce the > overall success chances of the new version. Compatibility breakup is not > binary, it accumulates. The more features are broken, the worse the > situation becomes. >
I couldn't agree more.
> >1. Remove register_globals completely > > > >2. Remove magic_quotes_* > > Given what I said above, I don't see any motivation to remove > register_globals or magic_quotes. I don't see how it buys us anything > other than pissed off users and hordes of (sometimes exploitable) bugs that > will result from sloppy audits. These changes alone would mean that a > great deal of the applications would have to be 100% audited before an > upgrade. Between us, developers welcoming forced labor due to upgrades is > wishful thinking. People never like to be forced to go over their or other > people's code regardless of the circumstances. >
+1000 for not removing the register_globals.
> > As I'm sure you'd agree, academic purity is not exactly why PHP won the > hearts of the masses. I would almost argue the opposite. Features which > only bother us due to academic purity are clearly ones we shouldn't > touch. Even more so than register_globals and magic_quotes - which are not > only impure but also problematic - there's no point forcing people to > modify their code just because we feel like making PHP more academically > pure. Other than creating a huge worldwide mess and slowing down > migration, we're not going to gain anything (assuming we don't get any > points for academic purity; PHP scored 100 when handed in as an academic > project, by the way :). > > Even if we forget about the users, and only think about ourselves - unless > something drastic happens, we're going to look at supporting 4 major > different versions simultaneously - 4.3/4.4, 5.0, 5.1 and 6.0. Is it > really such a great idea to start breaking compatibility beyond what we > absolutely have to? > > I think you have some good ideas in that list, and some less good > ideas. I'm worried about the wholesale mode that internals@ switched into, > the almost unanimous "YES!" response, and the overall feeling that suddenly > with 6.0 breakage comes without a price. That goes counter to our key > design goals in the Unicode support, which were work-as-if-nothing-happened > when unicode support is disabled.
I sure hope others come to support your way of thinking. Sometimes the purist way of thinking can cause more problems than good.

Lukas Smith

21 years ago
Zeev Suraski wrote:
> Even if we forget about the users, and only think about ourselves - > unless something drastic happens, we're going to look at supporting 4 > major different versions simultaneously - 4.3/4.4, 5.0, 5.1 and 6.0. Is > it really such a great idea to start breaking compatibility beyond what > we absolutely have to?
I agree that breaking BC is not a binary thing. I also agree that not being academically pure has not prevent PHP from succeeding on quite a large scale. However I think stuff like renaming functions and dropping aliases can be easily countered by a BC lib like PEAR::PHP_Compat (http://pear.php.net/package/PHP_Compat/). There is even a package in PEAR that will determine the necessary includes you will need to make based on your code and your PHP version (http://pear.php.net/package/PHP_CompatInfo/). Finally to fix stuff like parameter order we also have a tool readily available (with a few minor tweaks to also cover internal functions) which is called runkit (http://pecl.php.net/package/runkit). Beyond that runkit also gives us sandboxing, which in absence of a proper taint model is a huge step forward in handling data which may come from all sort of distributed sources in larger projects. As for removing register globals, a simple auto prepend will get you register globals back, same goes for magic quotes. But moving this stuff into userland will force people to take another hard look at their code. So I think we have all the tools available to make PHP alot cleaner without forcing people to rewrite their code. Since while our mess has not hurt us, I am sure it has not helped us either. regards, Lukas

George Schlossnagle

21 years ago
On Aug 14, 2005, at 1:08 PM, Lukas Smith wrote:
> > As for removing register globals, a simple auto prepend will get > you register globals back, same goes for magic quotes. But moving > this stuff into userland will force people to take another hard > look at their code.
Also a good thing for PHP_Compat.

Ilia A.

21 years ago
register_globals have been deprecated since 4.2 so any modern application should no rely on them if not for security then at least for compatibility. Removing register globals would probably halve (if not more) the number of security exploits (seem to number in 10s per day if securityfocus stats are to be believed). If this is not good enough of a reason to finally drop this legacy feature, I don't know what is. As far as magic_quotes_gpc goes, yes it will cause some initial pain for people who have not considered this option to be off. But in the long run it'll increase security by forcing people to use proper input validation techniques, leading to better more secure code. Ilia Zeev Suraski wrote:

Al Baker

21 years ago
I agree with Ilia that removing these would help drastically reduce the security holes present in PHP applications and generally improve the image of PHP security. Or an alternative way to say that, is it would reduce the FUD being slung at PHP from ignorant people saying PHP is a security nightmare. An embedded opcode cache I think is also essential and the surrounding $_MEMORY sounds perfect to me. All Java guys (yeah I know PHP != Java) say PHP isn't ready for the enterprise because it can't share information between processes other than arcane sessions. Having PHP become even faster also buys us not only play in the enterprise but scalability since it takes less to do what we do today. Regards, Al On Sun, 2005-08-14 at 13:11 -0400, Ilia Alshanetsky wrote:

George Schlossnagle

21 years ago
On Aug 14, 2005, at 1:24 PM, Al Baker wrote:
> An embedded opcode cache I think is also essential and the surrounding > $_MEMORY sounds perfect to me. All Java guys (yeah I know PHP != > Java) > say PHP isn't ready for the enterprise because it can't share > information between processes other than arcane sessions.
The use of name calling and other ad hominem attacks usually indicate that someone has already lost the argument. Not that you're doing this -- I'm referring to critiques of PHP's session facility by Java folks that amount to calling it arcane, hackish of whatever. George

Ondrej Ivanič

21 years ago
Al Baker wrote:
> An embedded opcode cache I think is also essential and the surrounding > $_MEMORY sounds perfect to me. All Java guys (yeah I know PHP != Java) > say PHP isn't ready for the enterprise because it can't share > information between processes other than arcane sessions. Having PHP > become even faster also buys us not only play in the enterprise but > scalability since it takes less to do what we do today.
At now, data sharing is possible in two ways: 1) Shared Memory Functions 2) apache_note() function Second method is simple and you need only some king of data serialization/deserialization, but is available only with Apache web server. First method is good for read-only data. Write to shmem segment is some times difficult (shmem segment have fixed size). Data serialization/deserialization is also required. It will be nice to have a simple method...
-- Ondrej Ivanic (ondrej@kmit.sk)

Rasmus Lerdorf

21 years ago
Ondrej Ivanič wrote:
> Al Baker wrote: > >> An embedded opcode cache I think is also essential and the surrounding >> $_MEMORY sounds perfect to me. All Java guys (yeah I know PHP != Java) >> say PHP isn't ready for the enterprise because it can't share >> information between processes other than arcane sessions. Having PHP >> become even faster also buys us not only play in the enterprise but >> scalability since it takes less to do what we do today. > > > At now, data sharing is possible in two ways: > > 1) Shared Memory Functions > 2) apache_note() function > > Second method is simple and you need only some king of data > serialization/deserialization, but is available only with Apache web > server. > > First method is good for read-only data. Write to shmem segment is some > times difficult (shmem segment have fixed size). Data > serialization/deserialization is also required. > > It will be nice to have a simple method...
pecl/apc has apc_store/apc_fetch: http://livedocs.phpdoc.info/index.php?l=en&q=function.apc-store The problem with having a real shared memory based global is that on every single access you need to lock. And if you make references to it you have to track the fact that the allocator for that one piece is completely different. It would be a pretty drastic change that would complicate a lot of things. It makes more sense to me to take an approach like apc_fetch() does where the value is copied into your address space for the duration of the request. If you need to change it, you apc_store() a new value. The lock only happens once on the read and once on the write. Of course, you can't really implement a counter this way, for example, since there is no lock that spans the read and the write. That could be gotten around with some specialty functions like apc_increment and apc_append perhaps. The target for apc_store/fetch really was read-heavy things. It wasn't intended to be a heavy-duty read-write IPC mechanism between processes. -Rasmus

Ondrej Ivanič

21 years ago
> > pecl/apc has apc_store/apc_fetch: > > http://livedocs.phpdoc.info/index.php?l=en&q=function.apc-store
I know about APC, but IMHO I can't use it. On webservers are Zend Optimizer or mmcache (eAccelerator now) used.
-- Ondrej Ivanic (ondrej@kmit.sk)

Guillaume Ponçon

21 years ago
Ondrej Ivanič wrote:
>> >> pecl/apc has apc_store/apc_fetch: >> >> http://livedocs.phpdoc.info/index.php?l=en&q=function.apc-store > > > I know about APC, but IMHO I can't use it. On webservers are Zend > Optimizer or mmcache (eAccelerator now) used. >
But the approach is very interesting. The french java developpers and a lot of others need these shared memory functions. I think that a displacement in PHP (memory_fetch, memory_store), even with small locks about which Rasmus speaks would be very appreciated ;).
-- Guillaume Ponçon

Ilia A.

21 years ago
If you just want memory access PHP already offers shmop extension for raw data storage and manipulation as well as sysvshm for storing serialized variables. Ilia Guillaume Ponçon wrote:

Guillaume Ponçon

21 years ago
It's true. I know shmop, but the ideal would be to be able to store large persistent variables in memory without serialization operations (without deserialization with each reading). Thanks for these informations. Guillaume Ilia Alshanetsky wrote:

Pierre-Alain Joye

21 years ago
Hello, PHP 5 was an evolution of php4, adding good OO things and some new extensions. PHP 5.1 is going a bit further and make the new engine more efficient. Both keep old and annoyed things we had in php4. PHP 6.0 is not going to be realease in the next months or maybe even not this year. PHP5 adoption is still anedoctic regarding php4 usages. So let say people will have a lot of time to changes their codes and test it. Or are you considering that having everything we had since php4 until the end of the days? Regards, --Pierre

David Zülke

21 years ago
> First of all, in general - I don't subscribe to the school of 'we broke > something, why not break more'. With every feature we break, we reduce > the > chances of people upgrading, of legacy apps working, and we reduce the > overall success chances of the new version. Compatibility breakup is not > binary, it accumulates. The more features are broken, the worse the > situation becomes. > > Given what I said above, I don't see any motivation to remove > register_globals or magic_quotes. I don't see how it buys us anything > other than pissed off users and hordes of (sometimes exploitable) bugs > that > will result from sloppy audits. These changes alone would mean that a > great deal of the applications would have to be 100% audited before an > upgrade. Between us, developers welcoming forced labor due to upgrades is > wishful thinking. People never like to be forced to go over their or > other > people's code regardless of the circumstances. > > If we are to do anything about register_globals, perhaps we can change the > name of the directive to something else (e.g. unprotected_globals), and of > course keep its default 0. Admins will have to make an informed decision > to turn it on again, and we can speak against it as strongly as we want in > an upgrade guide. > > Change the default of magic_quotes_gpc to 0 as well.
The question is: should we always care about users who are relying on behaviour that has been deprecated for ages. And the question is: should we feel responsible for the fact that everyone and their mother is buying a "PHP for Dummies" book nowadays and writing apps the day after, including some nice security vulnerabilities. If PHP always has to take care of the weakest link in the chain (the potentially drop dead stupid "pro" developer), we'll never get the chance to clean up legacy annoyances, introduce new stuff and break with things that a majority of people see as a pain in the elsewhere. - David

Rasmus Lerdorf

21 years ago
Zeev Suraski wrote:
> If we are to do anything about register_globals, perhaps we can change > the name of the directive to something else (e.g. unprotected_globals), > and of course keep its default 0. Admins will have to make an informed > decision to turn it on again, and we can speak against it as strongly as > we want in an upgrade guide.
I think that would be a really bad idea. Code that tries to be portable and uses ini_get('register_globals') would now be lying to us? Or do we add unprotected_globals as an alias? So instead of getting rid of it, we now have two directives that mean the same thing? I think we took the major BC breakage hit when we turned it off. And a simple extract($_REQUEST,EXTR_SKIP) restores these in an app that needs it, so it isn't really a question of auditing lots of code, just knowing what needs it and what doesn't.
> Change the default of magic_quotes_gpc to 0 as well. > >> 3. Add input filter extension which will include a mechanism for >> application developers to very easily turn it off which would swap >> the raw GPC arrays back in case the site had it turned on by default. > > Sounds good.
Doesn't really make sense to add the filter extension and keep magic_quotes_gpc. They would be stepping on each others toes. A magic_quotes_gpc filter would be trivial to add to the filter extension. We could even add a slight hack that would set the magic_quotes_gpc ini var so apps checking for it with ini_get() would see it if it was implemented via the filter extension. I have probably been one of the bigger proponents of not breaking BC over the years. And I did choose my list of things quite carefully to avoid wholesale breakage. I am completely against changing function names or re-ordering arguments since this is purely aesthetic. However, there isn't much point in deprecating things if we are never going to remove anything and I don't think pushing register_globals and magic_quotes_gpc down to the application level making them the exception rather than the rule is much of a break. Just about every portable app I have seen lately check for these, so none of those will break since ini_get('register_globals') will simply return false all the time now. Many more don't even check anymore and just assume it is off which becomes a problem on servers where the admin has one or two old apps that need it on and turn it on for the whole server because of it. The security problems often occur in the non-register_globals apps on such a server because the authors never even considered that they would be on. I think a one-liner fix or an auto_prepend to these old apps is worth the hassle. -Rasmus

Jani Taskinen

21 years ago
On Sun, 14 Aug 2005, Zeev Suraski wrote:
> worried about the wholesale mode that internals@ switched into, the almost > unanimous "YES!" response, and the overall feeling that suddenly with 6.0
Good. Phear the masses. It's not your vote that counts anymore. --Jani

l0t3k

21 years ago
i dont consistently agree with Zeev's opinions, but what was that for ??? l0t3k "Jani Taskinen" <sniper@iki.fi> wrote in message news:Pine.LNX.4.61.0508142314220.6705@arfg.argcubovn.sv...

Andrei Zmievski

21 years ago
Let's keep it pleasant, please. -Andrei On Aug 14, 2005, at 1:16 PM, Jani Taskinen wrote:

Zeev Suraski

21 years ago
At 23:16 14/08/2005, Jani Taskinen wrote:
>On Sun, 14 Aug 2005, Zeev Suraski wrote: > >>worried about the wholesale mode that internals@ switched into, the >>almost unanimous "YES!" response, and the overall feeling that suddenly >>with 6.0 > > Good. Phear the masses. It's not your vote that counts anymore.
Jani, You and the rest of the people on internals@ are not the masses nor do they represent them in any way. When a 'non-contributor' dares to voice an opinion, he's shut up because he's, well, a non-contributor. He's the one that matters, though, not you. Just in case you didn't know, the masses are php-general@, the ones who use PHP, and as anybody who wanders around #php.bugs knows, caring for those is not exactly first on your priority list. I wonder what the same poll would have looked if we took it to php-general@. Are you starting to 'phear the masses' yet? That was a stupid response, Jani. Zeev

Sebastian Bergmann

21 years ago
Zeev Suraski schrieb:
> That was a stupid response, Jani.
Maybe we should collect and publish (with a PEPr-like system, for instance) the suggestions that came up in this way-too-long thread and let the php-general readers comment/vote on them. Having the suggestions collected (either in separate text files in CVS or in a web-bases system) would be a good idea anyways.
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Derick Rethans

21 years ago
On Mon, 15 Aug 2005, Sebastian Bergmann wrote:
> Zeev Suraski schrieb: > > That was a stupid response, Jani. > > Maybe we should collect and publish (with a PEPr-like system, for > instance) the suggestions that came up in this way-too-long thread and > let the php-general readers comment/vote on them.
Yeah, that sounds like a really good idea to postpone PHP 6 for another 3 years. ;-)
> Having the suggestions collected (either in separate text files in CVS > or in a web-bases system) would be a good idea anyways.
I think we shouldn't go overboard with all the suggestions. We do want to ship the Unicode PHP this year - and just focussing on Rasmus' initial list seems the best way to me. Derick

Christian Schneider

21 years ago
Derick Rethans wrote:
> I think we shouldn't go overboard with all the suggestions. We do want > to ship the Unicode PHP this year - and just focussing on Rasmus' > initial list seems the best way to me.
I agree that the whole discussion went a bit overboard but on the other hand while Rasmus' list contains a lot of good points it also misses stuff which has been postponed for quite a while with arguments like "we will look into that for PHP 4.1, 5.0, 5.1, ...". Personally I'd rather make it Unicode only now, call it 5.5 and have someone (probably a small, defined group of people) in charge of collecting and deciding on a feature/change list for 6.0. Over and out, - Chris

Lester Caine

21 years ago
Derick Rethans wrote:
> Yeah, that sounds like a really good idea to postpone PHP 6 for another > 3 years. ;-)
I know you were joking, but DO WE REALLY WANT THREE VERSIONS OF PHP on the go ? We need a roadmap to ONE version - don't we?
>> Having the suggestions collected (either in separate text files in CVS >> or in a web-bases system) would be a good idea anyways. > > I think we shouldn't go overboard with all the suggestions. We do want > to ship the Unicode PHP this year - and just focussing on Rasmus' > initial list seems the best way to me.
Apart from unicode, nothing else on the list was something that could not be introduced in 5.1 or 5.2. The REAL problem is getting people who insist that PHP5 is no good to start switching from PHP4, so that it can be 'put to bed' rather than adding new features to that AS WELL ? The only time I have a problem with register_globals is where the source is PHP4 !
-- Lester Caine ----------------------------- L.S.Caine Electronic Services

Lukas Smith

21 years ago
Sebastian Bergmann wrote:
> Zeev Suraski schrieb: > >>That was a stupid response, Jani. > > > Maybe we should collect and publish (with a PEPr-like system, for > instance) the suggestions that came up in this way-too-long thread and > let the php-general readers comment/vote on them. > > Having the suggestions collected (either in separate text files in CVS > or in a web-bases system) would be a good idea anyways.
I am hoping that Steph will give us a nice summary in a timely manner. Aside from that its obviously a good idea to collect a list of all the suggestions. I dont think we really need PEPr for this. While I think its ok for anyone to come here and propose his wishes .. in the end the decisions will be made by the core php people. If someone provides a nice list for them it will make their work easier. regards, Lukas

Sebastian Bergmann

21 years ago
Lukas Smith schrieb:
> I dont think we really need PEPr for this.
Text files in CVS are fine by me, too.
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Sara Golemon

21 years ago
> You and the rest of the people on internals@ are not the masses nor do > they represent them in any way. When a 'non-contributor' dares to voice > an opinion, he's shut up because he's, well, a non-contributor. He's the > one that matters, though, not you. >
PHP doesn't need to be a true-democracy (unfocused and dismissive of the minority), nor an elitist oligarchy (insular and unresponsive to real needs). Yes, the php-general@ masses are the "voice of the people". The unwashed majority of the masses want simplicity and constancy, and it's important that they be provided with such. But there's also that marginalized minority of *good* scripters out there who will ultimately outgrow PHP because it doesn't offer the level of professional internal consistency they're looking for. It's our responsibilities, as contributors, maintainers, and those merely voicing concerns in open forum to consider all of the masses (unwashed and otherwise) when making decisions of internal focus. I appreciate that the "WishList" is long and aggressive. It's also not a binary image. Let's spread it all out on the table and compare what's good and not-so-good about it. The masses deserve that consideration. -Sara

Jochem Maas

21 years ago
loose comments, by no means aimed at Sara (who I happen to hold in high regard for not only here coding skills but also here general manner) Sara Golemon wrote:
>> You and the rest of the people on internals@ are not the masses nor do >> they represent them in any way. When a 'non-contributor' dares to >> voice an opinion, he's shut up because he's, well, a non-contributor. >> He's the one that matters, though, not you. >> > PHP doesn't need to be a true-democracy (unfocused and dismissive of the > minority), nor an elitist oligarchy (insular and unresponsive to real > needs).
here here. I would add that 'elitist oligarchy' is the worse end of the scale thought - right now I consider it more of a meritocracy - which is why IMHO Rasmus is king of the hill (beercan not included).
> > Yes, the php-general@ masses are the "voice of the people". The
it is, to me anyway, an interesting fact that Rasmus Lerdorf is the only core/dev guy/girl that is active (he posts killer stuff on a regular basis) - that is one thing that really strengthens any arguments he brings to the table IMHO, he actually talks to us mere mortals, and tries to guide us to better ways... I assume that tha ammount of stuff he reads on generals also gives him alot of insight into the 'state of the nation'. I certainly don't see any Zend guys in there getting their hands dirty and being proactive with the so called 'masses' - but Zend (I assume that Zeev's comments, in particular, can be, at least partially, construed as being conform to Zend corporate thinking regarding php development) seems to wave the 'don't upset the masses flag' quite hard.
> unwashed majority of the masses want simplicity and constancy, and it's > important that they be provided with such. But there's also that > marginalized minority of *good* scripters out there who will ultimately > outgrow PHP because it doesn't offer the level of professional internal > consistency they're looking for.
I would quitely consider myself just good enough to fall in the *good* category... I see it as my responsibility to drag the 'unwashed masses' kicking and screaming to a higher skill level - because mostly I don't want to be put into a situation where I outgrow php - I love it too much. I field quite a lot of 'dumb' questions at generals@ - always with an eye to passing on good practice basics (stuff you guys recommend, etc) in so far as I am capable - there are plenty like me out there. (number on the list of things that noobs are told not to do is use register_globals and magic_quotes_gpc) personally I think its fantastic that you all are looking far ahead and trying to plan/decide/figure out where its all going - especially in such an open manner - I still think php is great, and trust it will become greater still (not just the version number ;-) Kinds Regards, Jochem Maas

Zeev Suraski

21 years ago
Jochem, Even though you position yourself as a 'mere mortal' developer, you happen to be subscribed on internals@. That alone makes you much more 'hardcore PHPer' than 98.5% to 99.96% of the PHP developer community (*). You're much closer to the 'elitist oligarchy' than to the masses. Another thing to get out the door is that my position is not an official Zend stand, it's my personal position. I suspect Andi would think similarly but I'm sure he'd comment when he returns, and it's quite possible he thinks differently. Not sure about what others @Zend think, contrary to popular belief it's not a military-like organization and everyone's entitled to their own opinion, and they almost always have one. php-general is just one way of coming across real world developers. The huge amount of PHP users who correspond with me directly, and that I meet throughout my course of work (suffice to say Zend has way more customers than php-general has subscribers) are an excellent way to gauge the masses. Common sense helps as well - it's not by gauging the masses, nor by listening to every idea raised on internals@ (php-dev@ back in the days) that we've made PHP so successful. The reason we're even thinking about removing register_globals is thanks to the fact we had the guts to disable it by default, an effort that I'm proud to have led. Finally, the main issue I'm going against is the 'we can now break things!' approach. I don't have a problem with all of the points Rasmus made, just some of them. And the biggest problem is the mindset of the thread that followed it. Zeev At 17:53 15/08/2005, Jochem Maas wrote:

Pasha Zubkov

21 years ago
Zeev Suraski wrote:
> Finally, the main issue I'm going against is the 'we can now break > things!' approach. I don't have a problem with all of the points Rasmus > made, just some of them. And the biggest problem is the mindset of the > thread that followed it. > > Zeev
How long PHP must take care of old, very old scripts?! How long PHP must be "brute" language? Why you are so business related? Guys, you can create beautyfull and perfect language... but you worring about BC (read as business & money) and stupid users, that use old, deprecated and often unsecure functionality. Please, make PHP better, make it and don't look ahead.

Zeev Suraski

21 years ago
At 00:26 16/08/2005, Pasha Zubkov wrote:
>Zeev Suraski wrote: > > Finally, the main issue I'm going against is the 'we can now break > > things!' approach. I don't have a problem with all of the points Rasmus > > made, just some of them. And the biggest problem is the mindset of the > > thread that followed it. > > > > Zeev > >How long PHP must take care of old, very old scripts?!
'For as long as they're in widespread use' sounds about right, as long as it doesn't significantly impair new applications. Many of the points on Rasmus' list were cleanups that won't significantly change the lives of developers who want to write new apps, but will just make the lives of legacy app maintainers more difficult. Almost by definition they fall into the category of nice to haves. That said, with a proper workaround for legacy apps, it's conceivable. Zeev

Zeev Suraski

21 years ago
(*) Based on the fact php-general@ has 787 subscribers and current estimates at the amount of PHP developers worldwide range between 500,000 to 2,000,000 developers. I actually got the opening number wrong - it's 99.84%, not 98.5%. Sorry. Zeev At 18:29 15/08/2005, Zeev Suraski wrote:

George Schlossnagle

21 years ago
On Aug 15, 2005, at 11:38 AM, Zeev Suraski wrote:
> (*) Based on the fact php-general@ has 787 subscribers and current > estimates at the amount of PHP developers worldwide range between > 500,000 to 2,000,000 developers. I actually got the opening number > wrong - it's 99.84%, not 98.5%. Sorry.
You're probably being glib, but I don't think that being a dedicated, professional PHP developer has much to do with being on any of the lists. Most of the people I know who do serious work in PHP subscribe to none of the lists.php.net lists. It's probably not the best place to catch the pulse of the user-base. If anything, I'd assume that your own pro-services group and consulting partners would have better insight into what people are doing with PHP. George

Rasmus Lerdorf

21 years ago
Zeev Suraski wrote:
> (*) Based on the fact php-general@ has 787 subscribers and current > estimates at the amount of PHP developers worldwide range between > 500,000 to 2,000,000 developers. I actually got the opening number > wrong - it's 99.84%, not 98.5%. Sorry.
Not sure where you get your numbers from, and I have no idea what you are trying to say here, but php-general has 2954 subscribers, not 787 and internals has 837 (including digest users). And then of course there are a lot of people who use the nntp gateway and other mailing list gateways. -Rasmus

Zeev Suraski

21 years ago
At 18:45 15/08/2005, George Schlossnagle wrote:
>On Aug 15, 2005, at 11:38 AM, Zeev Suraski wrote: > >>(*) Based on the fact php-general@ has 787 subscribers and current >>estimates at the amount of PHP developers worldwide range between >>500,000 to 2,000,000 developers. I actually got the opening number >>wrong - it's 99.84%, not 98.5%. Sorry. > >You're probably being glib, but I don't think that being a dedicated, >professional PHP developer has much to do with being on any of the >lists. Most of the people I know who do serious work in PHP >subscribe to none of the lists.php.net lists. It's probably not the >best place to catch the pulse of the user-base. If anything, I'd >assume that your own pro-services group and consulting partners would >have better insight into what people are doing with PHP.
That's exactly what I was saying (in another part of the email). It doesn't work in reverse order though - being on one of these lists does usually mean that the developer is more 'hardcore' than others. Zeev

George Schlossnagle

21 years ago
On Aug 15, 2005, at 11:52 AM, Zeev Suraski wrote:
> > That's exactly what I was saying (in another part of the email). > It doesn't work in reverse order though - being on one of these > lists does usually mean that the developer is more 'hardcore' than > others.
Have you seen Harold and Kumar Go To WhiteCastle? 'hardcore' here reminds me of the 'extreme' guys from that movie. If you don't know the reference, I'm basically saying that being a 'hardcore' is often equivalent with being loud more than anything else. George

David Zülke

21 years ago
Interesting point of view. I'd consider the majority of people on generals@ to be less "hardcore" and "pro" and more "beginner" like, since they're usually coming there to ask questions. Hardcore PHP users needn't subscribe to generals@ since they don't need to ask questions. Makes sense? - David

Zeev Suraski

21 years ago
At 18:55 15/08/2005, George Schlossnagle wrote:
>On Aug 15, 2005, at 11:52 AM, Zeev Suraski wrote: >> >>That's exactly what I was saying (in another part of the email). >>It doesn't work in reverse order though - being on one of these >>lists does usually mean that the developer is more 'hardcore' than >>others. > >Have you seen Harold and Kumar Go To WhiteCastle? 'hardcore' here >reminds me of the 'extreme' guys from that movie. If you don't know >the reference, I'm basically saying that being a 'hardcore' is often >equivalent with being loud more than anything else.
Ok, that's not the meaning I meant :) Zeev

Joseph Crawford

21 years ago
I would like to see Multiple Inheritance implemented in a future version. I am not sure what obstacles got in the way (if any) for not implementing that in PHP 5 but i would defenately like to see that in PHP 6 or 7
-- Joseph Crawford Jr. Codebowl Solutions, Inc. 1-802-671-2021 codebowl@gmail.com

Rasmus Lerdorf

21 years ago
Joseph Crawford wrote:
> I would like to see Multiple Inheritance implemented in a future version. I > am not sure what obstacles got in the way (if any) for not implementing that > in PHP 5 but i would defenately like to see that in PHP 6 or 7
And if we had implemented MI, that would probably go on my wishlist to remove. MI is a very polarizing feature that people either love or hate. -Rasmus

Lukas Smith

21 years ago
Joseph Crawford wrote:
> I would like to see Multiple Inheritance implemented in a future version. I > am not sure what obstacles got in the way (if any) for not implementing that > in PHP 5 but i would defenately like to see that in PHP 6 or 7
IIRC, it was shot down. Use overloading and interfaces to get similar effects. regards, Lukas

Zeev Suraski

21 years ago
At 19:12 23/08/2005, Lukas Smith wrote:
>Joseph Crawford wrote: >>I would like to see Multiple Inheritance implemented in a future version. >>I am not sure what obstacles got in the way (if any) for not implementing >>that in PHP 5 but i would defenately like to see that in PHP 6 or 7 > >IIRC, it was shot down. Use overloading and interfaces to get similar effects.
You're right, it was, that's why we have interfaces. Zeev

Marcus Börger

21 years ago
Hello Zeev, Tuesday, August 23, 2005, 8:59:49 PM, you wrote:
> At 19:12 23/08/2005, Lukas Smith wrote: >>Joseph Crawford wrote: >>>I would like to see Multiple Inheritance implemented in a future version. >>>I am not sure what obstacles got in the way (if any) for not implementing >>>that in PHP 5 but i would defenately like to see that in PHP 6 or 7 >> >>IIRC, it was shot down. Use overloading and interfaces to get similar effects.
> You're right, it was, that's why we have interfaces.
Exactly. And you can emulate MI with __call(). The only thing we could probably add is delegates to overcome the anti-code-reuse interface aspect. // Some interface interface Printable { function print(); } // A general implementation for the interface class PrintHandler implements Printable { function print() { /* ... */ } } // A standard user class that implements the interface. Typically this is the // reason for MI since often you would just go with a standard impl for the // interfaced code. Actually common with containers (*). class Document implements Printable { delegate Printable $print; function __construct() { $this->print = new PrintHandler($this); } // No need to provide function print here - actually doing so is an error // since tit's body is automatically generated as a call to the delegate: // function print() { // if (!$this->print) throw new Exception("Delegate must not be NULL"); // $this->print->print(); // } } On the one hand this raises the complexity and syntax magic. On the other way it is really elegant and promotes code-reuse which is otherwise a pain with interfaces. (*) Actually the most prominent case is a general Container and a base class in a GUI Framwork. There the desktop and the windows need containers too. So you'd habe an interface to access the container and implement it againa and again...even though you already have it. And if you find a mistake - nobody tells you whether you fixed all incarnations of the code. Best regards, Marcus

Andi Gutmans

21 years ago
Again (I sound like a broken record), I don't think that we should add language constructs to support delegation. We will be overcomplicating things for PHP developers and it'll start to be hard to read PHP code. I do think it might be worth considering a user-land or internal class such as a Proxy class which would allow the advanced user to have more find-grained control on delegation. I'd still keep it simple. So basically I'd allow aggregating objects (or delegatees), and define their priority in the order they are added. Then there could be one method which overrides this priority by allowing to map methods to objects. For example something like: $proxy = new Proxy() $proxy->aggregate($obj2); /* Also aggregates interfaces */ $proxy->aggregate($obj3); $proxy->delegate($obj3, "method_that_exists_in_both_objects"); This would only be used in very advanced cases, most probably in frameworks but would be invisible to the average PHP developer. Complicating it more than this including the addition of language constructs doesn't seem good to me. If this isn't enough (and I"m sure there are some hypothetical cases where it might not be), then you could achieve the same goal in other ways... Still I am torn wether even this should be added. Andi At 12:57 PM 8/23/2005, Marcus Boerger wrote:

Zeev Suraski

21 years ago
At 18:50 15/08/2005, Rasmus Lerdorf wrote:
>Zeev Suraski wrote: > > (*) Based on the fact php-general@ has 787 subscribers and current > > estimates at the amount of PHP developers worldwide range between > > 500,000 to 2,000,000 developers. I actually got the opening number > > wrong - it's 99.84%, not 98.5%. Sorry. > >Not sure where you get your numbers from, and I have no idea what you >are trying to say here, but php-general has 2954 subscribers, not 787 >and internals has 837 (including digest users). And then of course >there are a lot of people who use the nntp gateway and other mailing >list gateways.
I meant internals@, not php-general. I refer specifically to people who are subscribed as those who are more hard-core than others. If you just read the digest occasionally or read it over the web, it's usually meaningless. Zeev

Marc Richards

21 years ago
Zeev Suraski wrote:
> At 18:50 15/08/2005, Rasmus Lerdorf wrote: > >> Zeev Suraski wrote: >> > (*) Based on the fact php-general@ has 787 subscribers and current >> > estimates at the amount of PHP developers worldwide range between >> > 500,000 to 2,000,000 developers. I actually got the opening number >> > wrong - it's 99.84%, not 98.5%. Sorry. >> >> Not sure where you get your numbers from, and I have no idea what you >> are trying to say here, but php-general has 2954 subscribers, not 787 >> and internals has 837 (including digest users). And then of course >> there are a lot of people who use the nntp gateway and other mailing >> list gateways. > > > I meant internals@, not php-general. I refer specifically to people who > are subscribed as those who are more hard-core than others. If you just > read the digest occasionally or read it over the web, it's usually > meaningless. > > Zeev
I read internals using Gmane and I check it pretty much every day. The only reason I subscribed (if I did in fact subscribe) was so that I could send replies. I read a bunch of other mailing-lists on a daily basis using Gmane that I don't actually send replies to. I am not necessarily trying to refute your point, just saying that there may be things you hadn't considered. Marc

Marc Richards

21 years ago
Marc Richards wrote:
> > > Zeev Suraski wrote: > >> At 18:50 15/08/2005, Rasmus Lerdorf wrote: >> >>> Zeev Suraski wrote: >>> > (*) Based on the fact php-general@ has 787 subscribers and current >>> > estimates at the amount of PHP developers worldwide range between >>> > 500,000 to 2,000,000 developers. I actually got the opening number >>> > wrong - it's 99.84%, not 98.5%. Sorry. >>> >>> Not sure where you get your numbers from, and I have no idea what you >>> are trying to say here, but php-general has 2954 subscribers, not 787 >>> and internals has 837 (including digest users). And then of course >>> there are a lot of people who use the nntp gateway and other mailing >>> list gateways. >> >> >> >> I meant internals@, not php-general. I refer specifically to people >> who are subscribed as those who are more hard-core than others. If >> you just read the digest occasionally or read it over the web, it's >> usually meaningless. >> >> Zeev > > > I read internals using Gmane and I check it pretty much every day. The > only reason I subscribed (if I did in fact subscribe) was so that I > could send replies. > > I read a bunch of other mailing-lists on a daily basis using Gmane that > I don't actually send replies to. I am not necessarily trying to refute > your point, just saying that there may be things you hadn't considered. > > > Marc
Ack. It looks like I am actually using news.php.net. But my main point was that on can read mialing list consistently without actually subscribing. Marc

Rasmus Lerdorf

21 years ago
Marc Richards wrote:
> I read a bunch of other mailing-lists on a daily basis using Gmane that > I don't actually send replies to. I am not necessarily trying to refute > your point, just saying that there may be things you hadn't considered.
You don't need to subscribe to post. The first time you try you just need to reply to a verify email and then you are on the self-approved list. And you, in fact, are not subscribed. I only see you on the self-approved list. (There are 27967 self-approved addresses) -Rasmus

Zeev Suraski

21 years ago
At 19:16 15/08/2005, Rasmus Lerdorf wrote:
>Marc Richards wrote: > > I read a bunch of other mailing-lists on a daily basis using Gmane that > > I don't actually send replies to. I am not necessarily trying to refute > > your point, just saying that there may be things you hadn't considered. > >You don't need to subscribe to post. The first time you try you just >need to reply to a verify email and then you are on the self-approved >list. And you, in fact, are not subscribed. I only see you on the >self-approved list. (There are 27967 self-approved addresses)
For all of the lists.php.net mailing lists combined, in case that wasn't clear. Zeev

Unnamed Person

21 years ago
As a decreasingly "hardcore" php user, any and/or all items on Rasmus' wishlist would be welcome. However, to comment on two items.... The strpos/in_array argument swap is one of my greatest joys in PHP. It keeps it lively. So I did a quick grep of the manual for "needle/haystack" type functions, and came up with the following. Perhaps there are other functions that use different argument names that I missed. There are really only 3 functions (array_key_exists, array_search and in_array) that use "needle, haystack" and are out of step with the others that use "haystack, needle". ---------------------------------------------- array_key_exists ( mixed key, array search) array_search ( mixed needle, array haystack [, bool strict]) iconv_strpos ( string haystack, string needle [, int offset [, string charset]]) iconv_strrpos ( string haystack, string needle [, string charset]) in_array ( mixed needle, array haystack [, bool strict]) mb_strpos ( string haystack, string needle [, int offset [, string encoding]]) mb_strrpos ( string haystack, string needle [, string encoding]) mb_substr_count ( string haystack, string needle [, string encoding]) stripos ( string haystack, string needle [, int offset]) stristr ( string haystack, string needle) strpbrk ( string haystack, string char_list) strpos ( string haystack, string needle [, int offset]) strrchr ( string haystack, string needle) strripos ( string haystack, string needle [, int offset]) strrpos ( string haystack, string needle [, int offset]) strstr ( string haystack, string needle) substr_count ( string haystack, string needle) ---------------------------------------------- My other great joy in PHP is the function naming (especially the str* family). Although I can actually remember which are str_* and which are str* (while I can NEVER remember the argument order of strpos), it would be nice to make naming consistent. So why are aliases (str_pos, str_tok, htmlentities_decode, etc.) out of the question? Indeed, I have a colleague who still uses mysql_numrows, mysql_fieldname and friends (of course, he also still runs PHP3 :).

Marcus Börger

21 years ago
Hello David, nice constructive helpfull work, thanks! best regardws marcus Monday, August 15, 2005, 8:49:35 PM, you wrote:
> As a decreasingly "hardcore" php user, any and/or all items on Rasmus' > wishlist would be welcome. However, to comment on two items....
> The strpos/in_array argument swap is one of my greatest joys in PHP. It > keeps it lively. So I did a quick grep of the manual for "needle/haystack" > type functions, and came up with the following. Perhaps there are other > functions that use different argument names that I missed. There are > really only 3 functions (array_key_exists, array_search and in_array) that > use "needle, haystack" and are out of step with the others that use > "haystack, needle".
> ---------------------------------------------- > array_key_exists ( mixed key, array search) > array_search ( mixed needle, array haystack [, bool strict]) > iconv_strpos ( string haystack, string needle [, int offset [, string > charset]]) > iconv_strrpos ( string haystack, string needle [, string charset]) > in_array ( mixed needle, array haystack [, bool strict]) > mb_strpos ( string haystack, string needle [, int offset [, string > encoding]]) > mb_strrpos ( string haystack, string needle [, string encoding]) > mb_substr_count ( string haystack, string needle [, string encoding]) > stripos ( string haystack, string needle [, int offset]) > stristr ( string haystack, string needle) > strpbrk ( string haystack, string char_list) > strpos ( string haystack, string needle [, int offset]) > strrchr ( string haystack, string needle) > strripos ( string haystack, string needle [, int offset]) > strrpos ( string haystack, string needle [, int offset]) > strstr ( string haystack, string needle) > substr_count ( string haystack, string needle) > ----------------------------------------------
> My other great joy in PHP is the function naming (especially the str* > family). Although I can actually remember which are str_* and which are > str* (while I can NEVER remember the argument order of strpos), it would > be nice to make naming consistent. So why are aliases (str_pos, str_tok, > htmlentities_decode, etc.) out of the question? Indeed, I have a colleague > who still uses mysql_numrows, mysql_fieldname and friends (of course, he > also still runs PHP3 :).
Best regards, Marcus

sebastian

21 years ago
Howdy all, I work at a company with about 8 programmers, and after some discussion we decided the following would be nice to add to the language: W1: Type hints. It'd be nice if you could mark a variable as string or int, so that if we set an int to "foozle" a warning will be raised. Of course type hints shouldn't be required, but it'd be nice if we could use them where we want. Before any one tries to suggest it: No, we will not create an object for integers and one for strings. W2: Lexical scoping. It'd be nice if we didn't have to worry about variables within a function conflicting. Any sort of code block-level scoping would be nice. Consider something like Perl's my() operator. At the very least, it'd be nice to be able to lexically close iteration variables used in loops. W3: Arrays and associative arrays - not some screwed up, problematic hybrid. We consider this to be a major flaw. Arrays should be arrays, associative arrays should be associative. This is especially problematic in reporting applications we develop. W4: Better lambda/anonymous functions and debugging for them. Consider Perl's anonymous functions which disappear as the references to them disappear. See the create_function() docs for notes about "memory leaks." Although they aren't really memory leaks, and there are simple work arounds, this behavior is rather sucky. Also, if I have something like: 15: array_map(create_function('$a',' echo $a; echo "\n"; ad934k33;;;asd! ' ), $list) I'll get an error about a lambda function line 3 at line 15 of script.php. It'd be nice if it told me it was on line 18 of script.php. Of course, this is wishful thinking. Perl has two forms of eval: string and block. For string evaluations with errors it tells me that the error occurred at line 3 of eval'ed code, but for block evals, it would tell me line 18... just something to think about. Regarding Rasmus' first post, I am: +1 removal of register globals +1 removal of magic_quotes +1 removal of really old deprecated functions and have nutral feelings about the rest. I'm happy with whichever provides the most simplicity and best performance. - sebastian

George Schlossnagle

21 years ago
On Aug 15, 2005, at 2:52 PM, sebastian wrote:
> > W4: Better lambda/anonymous functions and debugging for them. > Consider Perl's anonymous functions which disappear as the > references to them disappear. See the create_function() docs for > notes about "memory leaks."
Well, Perl subroutines are first class objects, while PHP functions are not. That having been said, one of the number one things I miss from perl is being able to say: $sub = { ... }; The nice part is that you don't need to do wacky escaping inside the text for the function. It would be swell for PHP to support: $func = function ($a,$b,$c) { // ... } and also require no escaping (even while using the existing create_function symbol table storage semantics).

Zeev Suraski

21 years ago
At 19:09 15/08/2005, Marc Richards wrote:
>Zeev Suraski wrote: >>At 18:50 15/08/2005, Rasmus Lerdorf wrote: >> >>>Zeev Suraski wrote: >>> > (*) Based on the fact php-general@ has 787 subscribers and current >>> > estimates at the amount of PHP developers worldwide range between >>> > 500,000 to 2,000,000 developers. I actually got the opening number >>> > wrong - it's 99.84%, not 98.5%. Sorry. >>> >>>Not sure where you get your numbers from, and I have no idea what you >>>are trying to say here, but php-general has 2954 subscribers, not 787 >>>and internals has 837 (including digest users). And then of course >>>there are a lot of people who use the nntp gateway and other mailing >>>list gateways. >> >>I meant internals@, not php-general. I refer specifically to people who >>are subscribed as those who are more hard-core than others. If you just >>read the digest occasionally or read it over the web, it's usually meaningless. >>Zeev > >I read internals using Gmane and I check it pretty much every day. The >only reason I subscribed (if I did in fact subscribe) was so that I could >send replies.
Wouldn't that prove my point exactly? :) Zeev

Zeev Suraski

21 years ago
At 20:08 14/08/2005, Lukas Smith wrote:
>Zeev Suraski wrote: > >>Even if we forget about the users, and only think about ourselves - >>unless something drastic happens, we're going to look at supporting 4 >>major different versions simultaneously - 4.3/4.4, 5.0, 5.1 and 6.0. Is >>it really such a great idea to start breaking compatibility beyond what >>we absolutely have to? > >I agree that breaking BC is not a binary thing. I also agree that not >being academically pure has not prevent PHP from succeeding on quite a >large scale. However I think stuff like renaming functions and dropping >aliases can be easily countered by a BC lib like PEAR::PHP_Compat >(http://pear.php.net/package/PHP_Compat/). There is even a package in PEAR >that will determine the necessary includes you will need to make based on >your code and your PHP version (http://pear.php.net/package/PHP_CompatInfo/).
Lukas, That's an excellent response. If one percent of the energy put into the 'yay parade' and the 'let's break this too!' parade were invested in coming up with a clean upgrade path, I wouldn't have had to write the response I wrote. That was not the tone of the letter initially sent. Quoting the header of the original letter (which was approved by way too many people): "It would mean many apps would need some work to work on PHP 6, but at the same time I think it is work people would welcome since it would mostly involve removing hacks instead of adding them." If we are to continue with that idea, we need to strike that one out completely. Instead, we need to come up with clear instructions on how to upgrade without forcing people to audit their applications. Your letter is a good first step. It's very much contradictory to the original letter (it is in fact adding more hacks to work around the removed features), but if we are to remove these features, that's the way to go. The way I see it, for every feature that we intend to discontinue, there needs to be a turnkey solution to work around, with a guide on how to do that, and a mention of the consequences if any. The way I see it #2, I still see next to no motivation to make some of the moves, since they buy us nothing other than academic purity. Zeev

Lukas Smith

21 years ago
Zeev Suraski wrote:
> If we are to continue with that idea, we need to strike that one out > completely. Instead, we need to come up with clear instructions on how > to upgrade without forcing people to audit their applications. Your > letter is a good first step. It's very much contradictory to the > original letter (it is in fact adding more hacks to work around the > removed features), but if we are to remove these features, that's the > way to go.
The point here is to move the hacks into the user space. This makes the language cleaner, but more importantly it means that less unnecessary stuff is handled via ini settings which makes portable apps considerably more doable. That is something which is very important. As for changes in functions. An alias cleanup really does need to happen at some point, especially if we are to add even more alias to deal with function naming cleanups :-) Parameter order fixes are another beast entirely. Maybe in the end alot of the functions that have inconsistent parameter orders also have inconsistent function names. So in those cases we might be able to "kill two flies at once" without having to resort to runkit and friends. Obviously in that case we cannot just add a standard alias for BC. regards, Lukas

George Schlossnagle

21 years ago
On Aug 15, 2005, at 5:05 AM, Zeev Suraski wrote:
> > That's an excellent response. If one percent of the energy put > into the 'yay parade' and the 'let's break this too!' parade were > invested in coming up with a clean upgrade path, I wouldn't have > had to write the response I wrote.
Would it be productive to compile a list of wants, then to agree that allowing BC/ensuring a good migration path will be a criteria by which these wants will be vetted? I agree that ensuring a migration path is critical. Wez and I were discussing this in the car this morning, and short of magic_quoutes_runtime, they all seemed like they were straightforward to handle through am include (except for the parameter order thing, but that's an awful awful idea). George

Zeev Suraski

21 years ago
At 16:36 15/08/2005, George Schlossnagle wrote:
>On Aug 15, 2005, at 5:05 AM, Zeev Suraski wrote: >> >>That's an excellent response. If one percent of the energy put >>into the 'yay parade' and the 'let's break this too!' parade were >>invested in coming up with a clean upgrade path, I wouldn't have >>had to write the response I wrote. > > >Would it be productive to compile a list of wants, then to agree that >allowing BC/ensuring a good migration path will be a criteria by >which these wants will be vetted?
It would definitely be a huge step forward, yes.
> I agree that ensuring a migration >path is critical. Wez and I were discussing this in the car this >morning, and short of magic_quoutes_runtime, they all seemed like >they were straightforward to handle through am include (except for >the parameter order thing, but that's an awful awful idea).
Where does using case sensitive identifiers fall? Zeev

George Schlossnagle

21 years ago
On Aug 15, 2005, at 10:18 AM, Zeev Suraski wrote:
>> I agree that ensuring a migration >> path is critical. Wez and I were discussing this in the car this >> morning, and short of magic_quoutes_runtime, they all seemed like >> they were straightforward to handle through am include (except for >> the parameter order thing, but that's an awful awful idea). >> > > Where does using case sensitive identifiers fall?
In my opinion? It's a huge BC break, and one that would be impossible without a ... feature request N) A global __call() method that handles any call to undefined functions. Similar in concept to registering a main::AUTOLOAD in Perl. I personally think this would be both useful and evil for all the same reasons that AUTOLOAD is both useful and evil in Perl. George

Wez Furlong

21 years ago
On 8/15/05, Zeev Suraski <zeev@zend.com> wrote:
> Where does using case sensitive identifiers fall?
As something of a dream, without the additional infrastructure that George described. Personally, I don't really mind if we get case sensitivity or not; the other items on Rasmus' list all seem very reasonable and (with the exception of magic_quotes_runtime) can be pretty easily emulated in user-space. --Wez.

Derick Rethans

21 years ago
On Mon, 15 Aug 2005, Wez Furlong wrote:
> On 8/15/05, Zeev Suraski <zeev@zend.com> wrote: > > Where does using case sensitive identifiers fall? > > As something of a dream, without the additional infrastructure that > George described. > > Personally, I don't really mind if we get case sensitivity or not; the > other items on Rasmus' list all seem very reasonable and (with the > exception of magic_quotes_runtime) can be pretty easily emulated in > user-space.
The filter ext's new specs have a filter for that now. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Zeev Suraski

21 years ago
At 20:52 14/08/2005, Rasmus Lerdorf wrote:
>Zeev Suraski wrote: > > If we are to do anything about register_globals, perhaps we can change > > the name of the directive to something else (e.g. unprotected_globals), > > and of course keep its default 0. Admins will have to make an informed > > decision to turn it on again, and we can speak against it as strongly as > > we want in an upgrade guide. > >I think that would be a really bad idea. Code that tries to be portable >and uses ini_get('register_globals') would now be lying to us? Or do we >add unprotected_globals as an alias? So instead of getting rid of it, >we now have two directives that mean the same thing?
While that can easily be solved (making register_globals a read only alias of unprotected_globals), I'm not sold on this idea, although it does the same job as userland solution. Zeev

Derick Rethans

21 years ago
On Mon, 15 Aug 2005, Zeev Suraski wrote:
> At 20:52 14/08/2005, Rasmus Lerdorf wrote: > >Zeev Suraski wrote: > > > If we are to do anything about register_globals, perhaps we can change > > > the name of the directive to something else (e.g. unprotected_globals), > > > and of course keep its default 0. Admins will have to make an informed > > > decision to turn it on again, and we can speak against it as strongly as > > > we want in an upgrade guide. > > > >I think that would be a really bad idea. Code that tries to be portable > >and uses ini_get('register_globals') would now be lying to us? Or do we > >add unprotected_globals as an alias? So instead of getting rid of it, > >we now have two directives that mean the same thing? > > While that can easily be solved (making register_globals a read only alias of > unprotected_globals), I'm not sold on this idea, although it does the same job > as userland solution.
I think changing register_globals to a different name is a silly idea. You're only making things harder here. Perhaps you forgot that Rasmus was always advocating that register globals is a good thing, but now he actually wants to get rid of it after he saw the enourmous amounts of problems it caused regarding the security of our users' webapps. Not supporting him here in getting rid of this extremely (off-by default) horrid feature is definitely the way forward. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Zeev Suraski

21 years ago
At 12:29 15/08/2005, Derick Rethans wrote:
>I think changing register_globals to a different name is a silly idea. >You're only making things harder here. Perhaps you forgot that Rasmus >was always advocating that register globals is a good thing, but now he >actually wants to get rid of it after he saw the enourmous amounts of >problems it caused regarding the security of our users' webapps.
Are you kidding me, how can I forget? I lead the effort to turn this darned thing off 3 or 4 years ago. I remember all too well how difficult it was, and the headaches it caused when it was done, but it was worth it. It doesn't mean I think we can just make it disappear without providing users with an upgrade path that does not include auditing their entire codebase. Yes, a script in userspace (bundled and without dependencies) is acceptable.
> Not >supporting him here in getting rid of this extremely (off-by default) >horrid feature is definitely the way forward.
I think you negated yourself once too many :) Zeev

Derick Rethans

21 years ago
On Mon, 15 Aug 2005, Zeev Suraski wrote:
> > Not > >supporting him here in getting rid of this extremely (off-by default) > >horrid feature is definitely the way forward. > > I think you negated yourself once too many :)
No, one time to less ;-) -> "...is definitely NOT the way forward." Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Jani Taskinen

21 years ago
First: Where can I get that stuff you're smoking? :) On Mon, 15 Aug 2005, Zeev Suraski wrote:
> upgrade path that does not include auditing their entire codebase. Yes, a > script in userspace (bundled and without dependencies) is acceptable.
extract() was already mentioned (by Rasmus even?) so I don't understand why you're still trying to propose something as silly as renaming register_globals.. --Jani

Zeev Suraski

21 years ago
At 13:07 15/08/2005, Jani Taskinen wrote:
> First: Where can I get that stuff you're smoking? :)
I think you know the Lebanese drug routes better than I do ;)
>On Mon, 15 Aug 2005, Zeev Suraski wrote: >>upgrade path that does not include auditing their entire codebase. Yes, >>a script in userspace (bundled and without dependencies) is acceptable. > > extract() was already mentioned (by Rasmus even?) so I don't understand > why you're still trying to propose something as silly as renaming > register_globals..
I read the whole thread and didn't see it being mentioned even once. It certainly wasn't mentioned in the initial email - quite on the contrary, the original email suggested that this 'forced labor' would be welcome by the users since they'd be removing hacks instead of adding ones. With each feature that we provide the script and guidelines for maintaining compatibility, I don't see a big problem. I don't see much of a gain either, but whatever. Features where we can't offer compatibility should not be touched. Zeev

Rasmus Lerdorf

21 years ago
Zeev Suraski wrote:
> I read the whole thread and didn't see it being mentioned even once.
http://news.php.net/php.internals/18063 In a reply directly to you. You even replied to it and quoted from it. -Rasmus

Zeev Suraski

21 years ago
At 16:30 15/08/2005, Rasmus Lerdorf wrote:
>Zeev Suraski wrote: > > I read the whole thread and didn't see it being mentioned even once. > >http://news.php.net/php.internals/18063 > >In a reply directly to you. You even replied to it and quoted from it.
Emm yes, before I wrote my first reply, of course. Zeev

Rasmus Lerdorf

21 years ago
Zeev Suraski wrote:
> At 16:30 15/08/2005, Rasmus Lerdorf wrote: > >> Zeev Suraski wrote: >> > I read the whole thread and didn't see it being mentioned even once. >> >> http://news.php.net/php.internals/18063 >> >> In a reply directly to you. You even replied to it and quoted from it. > > Emm yes, before I wrote my first reply, of course.
I think it is a given that upgrade paths would be documented and in some cases, like by adding a magic_quotes_gpc emulation mode to ext/filter, we might go beyond documentation. My initial list was directed at internals, not end users, so I didn't think I needed to point out all the ways to emulate these things from userspace. -Rasmus

Zeev Suraski

21 years ago
At 16:47 15/08/2005, Rasmus Lerdorf wrote:
>Zeev Suraski wrote: > > At 16:30 15/08/2005, Rasmus Lerdorf wrote: > > > >> Zeev Suraski wrote: > >> > I read the whole thread and didn't see it being mentioned even once. > >> > >> http://news.php.net/php.internals/18063 > >> > >> In a reply directly to you. You even replied to it and quoted from it. > > > > Emm yes, before I wrote my first reply, of course. > >I think it is a given that upgrade paths would be documented and in some >cases, like by adding a magic_quotes_gpc emulation mode to ext/filter, >we might go beyond documentation. My initial list was directed at >internals, not end users, so I didn't think I needed to point out all >the ways to emulate these things from userspace.
An important part of my email was snipped here: "I read the whole thread and didn't see it being mentioned even once. It certainly wasn't mentioned in the initial email - quite on the contrary, the original email suggested that this 'forced labor' would be welcome by the users since they'd be removing hacks instead of adding ones." Anyway, whatever, as long as we're now all on the same page. Zeev

Sebastian Nohn

21 years ago
Zeev Suraski wrote:
> I think you have some good ideas in that list, and some less good > ideas. I'm worried about the wholesale mode that internals@ switched > into, the almost unanimous "YES!" response, and the overall feeling that > suddenly with 6.0 breakage comes without a price. That goes counter to > our key design goals in the Unicode support, which were > work-as-if-nothing-happened when unicode support is disabled.
Then don't call it "6.0". "5.2" or "5.5" would be OK. Unicode support is cool but calling a release "6.0" just because of that looks a litte bit like "hey perl, we reached the 6.0 before you" while everyone knows that PHP is from the internal point of view still far behind Perl 6. Remembers me a little bit of the "browser war" in the beginning of this decade. Every new major version gives PHP the chance to break up with things and a drastic cleanup would be very nice in my eyes. Sebastian

Johannes Schlueter

21 years ago
Hi, On Sunday 14 August 2005 16:50, Zeev Suraski wrote:
> >1. Remove register_globals completely > > > >2. Remove magic_quotes_* > > Given what I said above, I don't see any motivation to remove > register_globals or magic_quotes. I don't see how it buys us anything > other than pissed off users and hordes of (sometimes exploitable) bugs that > will result from sloppy audits. These changes alone would mean that a > great deal of the applications would have to be 100% audited before an > upgrade. Between us, developers welcoming forced labor due to upgrades is > wishful thinking. People never like to be forced to go over their or other > people's code regardless of the circumstances.
I don't agree here. First of all: I read many posts in different support forums by people who's application broke due the register_globals = Off change. We teached them to use super globals instead of register globals. It was hard to quote the same answer that often but it worked out - somehow. People now write code using super globals for external data and maybe even check them for bad data but they don't initialise their global variables proper. Running on a host with register_globals = On, like a mass hoster, this enables code-paths and vulnerabilities the original author didn't think of. Now what happens if we remove register_globals it won't hurt the ones doing what was suggested - using super globals. The applications that break can easily "fixed" by using extract() inside an auto_prepend file which might be easily provided in release notes, a PEAR Compatibility library and by different support forums. But it would fix problems existing since the programmer didn't think off it. (I myself had recently a problem with loosing one of my session variables which was hard to find. This only happend when the user opened a few pages in the right order since the application used a global variable with the same name as a session variable. Such things are hard to track if you work on large code basis and written for register_globals=off but it needs to run with the setting on) magic_quotes is even worse for portable applications. You always have to check wether it is on or off and in one case you need to process you input data. This is a wtf factor for someone starting with PHP - I can remember how I wondered when I got escaped data out of my database. Coming from other languages I was used to escape data so I did with PHP. Now, after quite some years of PHP in a daily basis it's a real pain. Reading different support forums there are quite often people asking where these escaping comes from and how to handle this - that's a real pain for the users. If it's removed it can easily replaced by the filter stuff or some auto_prepend-"magic". Both are things which can, after they were removed, easily simulated in user-space but won't hurt any new application and, as I wrote above, can simply by userland code. This would be hard for the support forums the first few months but with a good FAQ article giving solutions these can be solved without much too much trouble compared with the trouble they can create. The benefit with having this - well documented - in the userland is that it would (most of the time at least...) only be enabled for applications not written portable but new, portable, applications don't need to care about this. Now back to what you wrote, Zeev: In the part I quoted above you wrote that "applications would have to be 100% audited" I don't think so. You jut need to check wether it uses one off these settings and apply the proposed work-around. This should be doable by taking a look at the documentation or a short look on the code or even, without a look on the code, just check if it works (accepting input data and handling quotes right). If you really want to fix this it would takes longer- but you would need to fix it anyways if you want it to be portable and running under most setups.
> If we are to do anything about register_globals, perhaps we can change the > name of the directive to something else (e.g. unprotected_globals), and of > course keep its default 0. Admins will have to make an informed decision > to turn it on again, and we can speak against it as strongly as we want in > an upgrade guide.
I don't think renaming it would make anything better but just add a new wtf. johannes

Maxim Matyukhin

21 years ago
Just my 2 cents : 9. I don't know current status of apache_hooks (http://cvs.php.net/php-src/sapi/apache_hooks/) but it would be nice to make it stable with good documentation on php.net 10. make standarts for function's names. For example php has str_replace() and strpos(). I think last function should be named str_pos(). But if namespaces will be added to internal functions (str:replace, str:pos) it will be unnesseccary. 11. +1 namespaces 12. disable @ via settings 13. add keyword 'finally' to exceptions Rasmus Lerdorf :

Jeff Moore

21 years ago
On Aug 12, 2005, at 1:48 PM, Rasmus Lerdorf wrote:
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
This is a sweet carrot to drive adoption despite a few minor BC issues.

Mikko Rantalainen

21 years ago
Rasmus Lerdorf wrote:
> Since we are breaking a lot of stuff in 6.0, at least with > Unicode_semantics=On I am wondering if it may not be time to break some
+100 for Unicode support
> 1. Remove register_globals completely
+1
> 2. Remove magic_quotes_*
+100 (any "magic" is bad in the long run, see Perl)
> 3. Add input filter extension which will include a mechanism for > application developers to very easily turn it off which would swap > the raw GPC arrays back in case the site had it turned on by default.
+0
> 4. Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in. > > 5. Remove safe_mode and focus on open_basedir
+0.5 I think that safe_mode and similar kludges and hinges really shouldn't be in any language. OS needs to provide the security we need, it cannot *safely* be added at some higher level. As what to comes to renaming old function I don't like it. I've been hit with minor stuff like changing pgsql_numrows to pgsql_num_rows() in a minor release and even though there's an easy fix, it still not worth it. If you want to fix not-so-well named functions like in_array() or strstr() put the fixed functions in a new namespace or add a suffix like, for example, 2. So PHP6 could have strpos(haystack,needle) strpos2(needle,haystack) str:pos(needle,haystack) str::pos(needle,haystack) or some combination of above, but PHP6 *should not* have strpos(needle,haystack). If I were to decide, I would move all the old functions to new names into new namespaces and include a wrapper files with public domain license so that it could be freely modified as required. The PD licensed files contained just code like compatibility/str.php: .... function strpos(haystack,needle) { return str::pos(needle,haystack); } .... and the old code that required the old functions could just add require_once("compatibility/str.php"); in required files. That is, rename the functions as seen best and provide compatibility code in user space to make the old code work without big changes. In addition, I'd change following: * Handle incoming parameters and data better. According to HTTP specification, an URL can contains stuff like "...foo=1&foo=2&foo=3..." and I should be able to extract those values without having "[]" in every parameter name. See <select multiple> or <input type="file">, for example. I'd prefer "array query_param(param_name,method)" which returned an array of values for parameter named according to param_name. The optional method parameter is used to select GET, POST, DELETE, PUT or whatever. By default method would be ANY which would be interpreted as GET,POST,PUT,DELETE,COOKIE meaning return stuff sent with GET protocol first, followed by stuff sent by POST protocol and so on. I think GET should be used first because it's easiest to change. It is *not* a security feature to use COOKIE first because it can be modified almost as easily as GET. Debugging and workarounding different bugs is just harder if GET doesn't override values set by other means. * Improved file uploads. Make it possible for a PHP script to decline an upload *before* it has been completed. Make it possible to handle *big* uploads without requiring uploaded file to fit the memory. Handle multiple file uploads with the same name better than now. $_FILES['fieldname'][1]['filename'] if far from a good solution and even that works only if field is really named "fieldname[]". * Better error reporting. As I cannot capture ALL errors (including parse errors and friends) with user defined error handlers I need *much* better error messages to system log by default. At least exact time (perhaps down to microsecond?), back trace, error location (and in case it was eval()ed code, the location of eval() call - or locations of eval() calls if they were nested) would be required in addition to currently logged information. * Anonymous functions. The real stuff, not just some odd string passed to create_function().
-- Mikko

Marcus Börger

21 years ago
Hello Mikko, Monday, August 22, 2005, 4:09:31 PM, you wrote:
> Rasmus Lerdorf wrote: >> Since we are breaking a lot of stuff in 6.0, at least with >> Unicode_semantics=On I am wondering if it may not be time to break some
> +100 for Unicode support
>> 1. Remove register_globals completely
> +1
>> 2. Remove magic_quotes_*
> +100 (any "magic" is bad in the long run, see Perl)
>> 3. Add input filter extension which will include a mechanism for >> application developers to very easily turn it off which would swap >> the raw GPC arrays back in case the site had it turned on by default.
> +0
>> 4. Include an opcode cache by default. A lot of work has gone into >> pecl/apc recently, but I am not hung up on which one goes in. >> >> 5. Remove safe_mode and focus on open_basedir
> +0.5 I think that safe_mode and similar kludges and hinges really > shouldn't be in any language. OS needs to provide the security we > need, it cannot *safely* be added at some higher level.
> As what to comes to renaming old function I don't like it. I've been > hit with minor stuff like changing pgsql_numrows to pgsql_num_rows() > in a minor release and even though there's an easy fix, it still not > worth it. If you want to fix not-so-well named functions like > in_array() or strstr() put the fixed functions in a new namespace or > add a suffix like, for example, 2. So PHP6 could have
> strpos(haystack,needle) > strpos2(needle,haystack) > str:pos(needle,haystack) > str::pos(needle,haystack)
> or some combination of above, but PHP6 *should not* have
> strpos(needle,haystack).
> If I were to decide, I would move all the old functions to new names > into new namespaces and include a wrapper files with public domain > license so that it could be freely modified as required. The PD > licensed files contained just code like
> compatibility/str.php: > .... > function strpos(haystack,needle) > { > return str::pos(needle,haystack); > } > ....
> and the old code that required the old functions could just add > require_once("compatibility/str.php"); in required files. That is, > rename the functions as seen best and provide compatibility code in > user space to make the old code work without big changes.
> In addition, I'd change following:
> * Handle incoming parameters and data better. According to HTTP > specification, an URL can contains stuff like > "...foo=1&foo=2&foo=3..." and I should be able to extract those > values without having "[]" in every parameter name. See <select > multiple> or <input type="file">, for example. I'd prefer "array > query_param(param_name,method)" which returned an array of values > for parameter named according to param_name. The optional method > parameter is used to select GET, POST, DELETE, PUT or whatever. By > default method would be ANY which would be interpreted as > GET,POST,PUT,DELETE,COOKIE meaning return stuff sent with GET > protocol first, followed by stuff sent by POST protocol and so on. I > think GET should be used first because it's easiest to change. It is > *not* a security feature to use COOKIE first because it can be > modified almost as easily as GET. Debugging and workarounding > different bugs is just harder if GET doesn't override values set by > other means.
Read the docs and look for the upcoming input filtering.
> * Improved file uploads. Make it possible for a PHP script to > decline an upload *before* it has been completed. Make it possible > to handle *big* uploads without requiring uploaded file to fit the > memory. Handle multiple file uploads with the same name better than > now. $_FILES['fieldname'][1]['filename'] if far from a good solution > and even that works only if field is really named "fieldname[]".
You can always grep the names, you can always access the raw data and well early declining would require some more interaction with the sapi. So you'd first need to contact the sapi wroters or find out whetehr that is possible at all. The we'd need to find out how to handle that. In theory you have now two threads, hmmm.
> * Better error reporting. As I cannot capture ALL errors (including > parse errors and friends) with user defined error handlers I need > *much* better error messages to system log by default. At least > exact time (perhaps down to microsecond?), back trace, error > location (and in case it was eval()ed code, the location of eval() > call - or locations of eval() calls if they were nested) would be > required in addition to currently logged information.
At least apache should be able to write microseconds, on windows system sthe problem would be the resolution of the internal time which is ~10ms. And an E_PARSE will never be catchable by a PHP script.
> * Anonymous functions. The real stuff, not just some odd string > passed to create_function().
There were some others already asking for this, maybe we should at least give it a thought if it is doable at all, anybody? Best regards, Marcus

Stanislav Malyshev

21 years ago
MB>>> * Anonymous functions. The real stuff, not just some odd string MB>>> passed to create_function(). MB>> MB>>There were some others already asking for this, maybe we should at least MB>>give it a thought if it is doable at all, anybody? Just out of curiosity, what's bad in create_function and how "real" ones should be different?
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115

l0t3k

21 years ago
i think that create_function() does an eval() at runtime, which is more expensive. anonymous functions would be handled in the compiler. l0t3k "Stanislav Malyshev" <stas@zend.com> wrote in message news:Pine.LNX.4.62.0508222107200.13397@shire.zend.office...

Stanislav Malyshev

21 years ago
l>>i think that create_function() does an eval() at runtime, which is more l>>expensive. anonymous functions would be handled in the compiler. Well, since function code is compiled once anyway, it shouldn't matter much when it is compiled - before first opcode was executed or after that.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115

l0t3k

21 years ago
i think that create_function() does an eval() at runtime, which is more expensive. anonymous functions would be handled in the compiler. l0t3k "Stanislav Malyshev" <stas@zend.com> wrote in message news:Pine.LNX.4.62.0508222107200.13397@shire.zend.office...

George Schlossnagle

21 years ago
On Aug 22, 2005, at 2:08 PM, Stanislav Malyshev wrote:
> MB>>> * Anonymous functions. The real stuff, not just some odd string > MB>>> passed to create_function(). > MB>> > MB>>There were some others already asking for this, maybe we should > at least > MB>>give it a thought if it is doable at all, anybody? > > Just out of curiosity, what's bad in create_function and how "real" > ones > should be different?
Two major differences as I see it: 1) syntactical: the amount of escaping/funkyjunk you need to do to have anonymous functions look like regular functions in their declaration is huge (yes, you can use heredocs, but they have their (big if you run up against them) limitations as well). 2) no garbage collection on them (so in something like perl, when you anonymous sub goes out of scope, it's cleaned up). 3) runtime vs. compiletime definition For me 3 is good the way it is (the whole point of anon. functions (for me) is to allow me to easily vary their definition at runtime). 2 I can see being a pain, but I don't consider it critical. 1 keeps me from using create_function - the required code is to obtuse to use in most cases - I really would like to be able to do: $max = function ($a, $b) { return $a < $b?$b:$a; } (for why heredocs suck here, consider the case where I want to use constants in the definition). George
> -- > Stanislav Malyshev, Zend Products Engineer > stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >
George Schlossnagle -- Vice President of Engineering -- OmniTI Computer Consulting -- http://www.omniti.com

Stanislav Malyshev

21 years ago
GS>>1) syntactical: the amount of escaping/funkyjunk you need to do to GS>>have anonymous functions look like regular functions in their GS>>declaration is huge (yes, you can use heredocs, but they have their GS>>(big if you run up against them) limitations as well). Well, this is right and valid, but if you use advanced stuff like closures you may expect you code look "advanced" :) GS>>2) no garbage collection on them (so in something like perl, when you GS>>anonymous sub goes out of scope, it's cleaned up). This is a valid concern, though I don't see how to fix it without creating a new type, and creating anew type just for that seems a bit of overkill to me. GS>>3) runtime vs. compiletime definition GS>> GS>>For me 3 is good the way it is (the whole point of anon. functions (for me) GS>>is to allow me to easily vary their definition at runtime). This one I miss. Like, why should it matter when you compile it? Compilation time is still the same. Even more, in runtime you don't spend time compiling it unless it's really needed. GS>>$max = function ($a, $b) { GS>> return $a < $b?$b:$a; GS>>} $max = create_function('$a,$b', 'return $a < $b?$b:$a;'); Is it _that_ different?
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115

Marcus Börger

21 years ago
Hello George, Monday, August 22, 2005, 9:53:02 PM, you wrote:
> On Aug 22, 2005, at 2:08 PM, Stanislav Malyshev wrote:
MB>>>> * Anonymous functions. The real stuff, not just some odd string  MB>>>> passed to create_function(). MB>>> MB>>>There were some others already asking for this, maybe we should at least MB>>>give it a thought if it is doable at all, anybody?
> Just out of curiosity, what's bad in create_function and how "real" ones  > should be different?
> Two major differences as I see it:
> 1) syntactical:  the amount of escaping/funkyjunk you need to do to > have anonymous functions look like regular functions in their declaration > is huge (yes, you can use heredocs, but they have their (big if you run up > against them) limitations as well).
> 2) no garbage collection on them (so in something like perl, when you > anonymous sub goes out of scope, it's cleaned up).
> 3) runtime vs. compiletime definition
> For me 3 is good the way it is (the whole point of anon. functions (for > me) is to allow me to easily vary their definition at runtime).
> 2 I can see being a pain, but I don't consider it critical.
> 1 keeps me from using create_function - the required code is to obtuse > to use in most cases - I really would like to be able to do:
> $max = function ($a, $b) { >   return $a < $b?$b:$a; > }
> (for why heredocs suck here, consider the case where I want to use constants in the definition).
4) Speed/Security. create_function() takes a string which is compiled at run-time. An unnamed function syntax would allow compilation at original compile time thus allowing compiler caching (speed) and prevents from executing modified code which is bad anyways (security). Last but not least for small functions the syntax support leeds to much more readable code, while on the other hand some tools might have trouble with create_function() strings. Best regards, Marcus

Michael Walter

21 years ago
On 8/22/05, Stanislav Malyshev <stas@zend.com> wrote:
> MB>>> * Anonymous functions. The real stuff, not just some odd string > MB>>> passed to create_function(). > MB>> > MB>>There were some others already asking for this, maybe we should at least > MB>>give it a thought if it is doable at all, anybody? > > Just out of curiosity, what's bad in create_function and how "real" ones > should be different?
"Real" anonymous functions (as in, closures) should be able to capture variables from its lexical environment, e.g.: function adder($a) {return function($b) {return $a+$b;}} function index($i) {return function($a) {return $a[$i];}} I'm sure you can think of useful examples. Cheers, Michael

Stanislav Malyshev

21 years ago
MW>> function adder($a) {return function($b) {return $a+$b;}} As opposed to: function adder($a) { return create_function('$b', 'return '.(integer)$a.'+$b;'); } Former form may be a bit prettier, but no substantial difference here.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115

Dmitry Stogov

21 years ago
> -----Original Message----- > From: Michael Walter [mailto:michael.walter@gmail.com] > Sent: Tuesday, August 23, 2005 10:18 AM > To: Stanislav Malyshev > Cc: Marcus Boerger; internals@lists.php.net > Subject: Re: [PHP-DEV] Re: PHP 6.0 Wishlist > > > On 8/22/05, Stanislav Malyshev <stas@zend.com> wrote: > > MB>>> * Anonymous functions. The real stuff, not just some > odd string > > MB>>> passed to create_function(). > > MB>> > > MB>>There were some others already asking for this, maybe > we should at > > MB>>least give it a thought if it is doable at all, anybody? > > > > Just out of curiosity, what's bad in create_function and how "real" > > ones should be different? > > "Real" anonymous functions (as in, closures) should be able > to capture variables from its lexical environment, e.g.: > > function adder($a) {return function($b) {return $a+$b;}} > function index($i) {return function($a) {return $a[$i];}} > > I'm sure you can think of useful examples.
I like this syntax and expected behavior. The only problem is implementation. Anonymous functions those don't capture variables from lexical scope can be compiled once at file compile time, instead of evaluating in create_function(). But I don't see how it can be done with variable capturing. Thanks. Dmitry.

Andi Gutmans

21 years ago
Guys, Anonymous functions are really a niche feature and tend to lead to pretty magical code. I really don't think that it's an important enough feature which would be usable to the mainstream PHP users. We really need to get a grip on the new features and not overcomplicate the language. There will always be a thousand and 1 niche features we can borrow from other languages but the big advantage and reason for PHP's success is its simplicity. I think that if you're one of those power users that requires this niche features then you can survive with create_function() or in cases of other features, with other ways of achieving the same goal... Andi P.S.- I learn ML at university which is almost 100% closures. Very ugly stuff... Unmaintainable and hard to parse in your brain. At 08:47 AM 8/23/2005, Dmitry Stogov wrote:

Zeev Suraski

21 years ago
At 18:47 23/08/2005, Dmitry Stogov wrote:
> > function adder($a) {return function($b) {return $a+$b;}} > > function index($i) {return function($a) {return $a[$i];}} > > > > I'm sure you can think of useful examples. > >I like this syntax and expected behavior. >The only problem is implementation.
That's far from being the only problem. Implementation is just about the last thing we should be thinking about when we deal with stuff like that. This syntax is unclear, much less verbose than create_function() and mixes runtime & compile time together. It's very LISPish, and there's nothing positive about that.
>Anonymous functions those don't capture variables from lexical scope can be >compiled once at file compile time, instead of evaluating in >create_function(). But I don't see how it can be done with variable >capturing.
Again, not only does create_function() allow you to do that easily, but it's also a heck of a lot clearer what comes from where. function index($i) { return create_function('$a', "return \$a[$i];"); } For the record, I think that the notion of 'function factories' is so rarely useful in and so alien to PHP that we shouldn't be wasting time on it, let alone consider introducing language constructs to support it. Zeev

Zeev Suraski

21 years ago
At 09:18 23/08/2005, Michael Walter wrote:
>On 8/22/05, Stanislav Malyshev <stas@zend.com> wrote: > > MB>>> * Anonymous functions. The real stuff, not just some odd string > > MB>>> passed to create_function(). > > MB>> > > MB>>There were some others already asking for this, maybe we should at > least > > MB>>give it a thought if it is doable at all, anybody? > > > > Just out of curiosity, what's bad in create_function and how "real" ones > > should be different? > >"Real" anonymous functions (as in, closures) should be able to capture >variables from its lexical environment, e.g.:
create_function() accepts a string, and that string is constructed with full access to the lexical scope of the creating function, so I'm not exactly sure how it's different. My ML/LISP memory fails me.
> function adder($a) {return function($b) {return $a+$b;}} > function index($i) {return function($a) {return $a[$i];}} > >I'm sure you can think of useful examples.
Since when do we consider moving towards LISP a good thing? :) For those odd ends where you really need that, create_function() can do the job for you just as well (before anybody complains that it's cumbersome - GOOD, it's supposed to be, you're not supposed to be creating functions on the fly unless you absolutely have to). Zeev

Noah Botimer

21 years ago
Zeev, My only gripe with create_function() is the inherent "dirt" involved in handing a code-containing string to a function. I've been living in the app development world for some time now, so my example stash is clean out, but my notion is that, for folks who have a real, novel application for an anonymous lambda function, the benefit of having it "fit in" with the rest of the language would be at least tangible. Granted, everything is effectively run-time in the PHP world, but the ability to employ regular syntax for these anonymous functions could be quite handy. Things like line numbers, code formatting, highlighting, and annotations would be as relevant as in "regular" code. I agree that we shouldn't look at the laundry list of every other language feature and include them all, but better support for anonymous functions would surely help some folks. That said, the ability to generate and run code from a string in one pass is handy, but maybe it's not just what the doctor ordered in some cases. I've always seen PHP as an enabling technology, allowing people to solve their problems in very novel and fitting ways. I'd hate to see that philosophy suffer when the problem space lends itself to functional programming. Thanks, -Noah On Aug 23, 2005, at 3:01 PM, Zeev Suraski wrote:

Michael Walter

21 years ago
Zeev, On 8/23/05, Zeev Suraski <zeev@zend.com> wrote:
> >"Real" anonymous functions (as in, closures) should be able to capture > >variables from its lexical environment, e.g.: > > create_function() accepts a string, and that string is constructed with > full access to the lexical scope of the creating function, so I'm not > exactly sure how it's different. My ML/LISP memory fails me.
It certainly does not appear to be that way in PHP 4, in the supposedly equivalent snippet: function adder($a) {return create_function('$b', 'return $a+$b;');} ..$a is not accessible from inside the anonymous function. This is the reason Stanislav put the content of $a into the code string (and probably the reason he chose adder() instead of index() for his "counter-example" ;).
> Since when do we consider moving towards LISP a good thing? :)
FWIW, I'm merely explaining the problem, not giving any opinion (too afraid of Derick ;). Cheers, Michael PS: Common Lisps get the garbage collection right, though! ;)

Michael Walter

21 years ago
Zeev, On 8/24/05, Michael Walter <michael.walter@gmail.com> wrote:
> On 8/23/05, Zeev Suraski <zeev@zend.com> wrote: > > >"Real" anonymous functions (as in, closures) should be able to capture > > >variables from its lexical environment, e.g.: > > > > create_function() accepts a string, and that string is constructed with > > full access to the lexical scope of the creating function, so I'm not > > exactly sure how it's different. My ML/LISP memory fails me.
I misread. The obvious difference is that you're not creating code strings in ML/LISP, so (1) you can avoid all kind of error-prone marshalling and (2) you can compile the function at compile-time and simply fill out its free variables when "instantiating" the closure (using the current lexical environment), giving you syntax checks & performance. I intentionally phrased that sentence to resemble object instantiation: In fact it's pretty much the same thing with more less verbose/local syntax! I.e. as I believe you said, it is certainly *not* a question of how/whether we want that functionality, but whether we want to encourage this particular style of programming. Cheers, Michael

Andi Gutmans

21 years ago
Michael, To your question, I don't want to encourage this style of programming. Andi At 10:24 PM 8/23/2005, Michael Walter wrote:

Jordan Miller

21 years ago
I just joined this list and caught this thread (no suggestions like this in the archive)... For v6.0... how about allowing comparison operator expressions like the following: if (2 < $x <= 4) {} I prefer this concise way as it is common for mathematics expressions, and much easier to grasp physically on first glance. From what I can tell, this expression can currently only be written as: if ( $x > 2 && $x <= 4) {} Would adding this syntax to PHP be incredibly difficult or lead to performance slowdowns? I think I remember reading that PHP always evaluates expressions from right to left, so I guess there may be a considerable codebase change required. Maybe there could be a default function workaround for this or some other way to automagically process these more concise expressions without too much of a slowdown?? Just curious. Jordan

Tex Texin

21 years ago
if (2 < $x <= 4) {} Doesn't this collide with its current meaning: if ( (2 < $x) <= 4) {} i.e. parsing left to right, the true/false result of 2 < $x, is compared with <= 4. Changing the meaning could break some programs. Tex Texin Internationalization Architect, Yahoo! Inc.

Stanislav Malyshev

21 years ago
JM>>I think I remember reading that PHP always evaluates expressions from right JM>>to left, so I guess there may be a considerable codebase change required. I personally don't see a point in "considerable codebase change" just for the sake of syntactic prettyness. It doesn't add anything to the language you couldn't easily do otherwise, and the benefit just doesn't justify the investment of effort in this.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115

Jani Taskinen

21 years ago
On Mon, 22 Aug 2005, Mikko Rantalainen wrote:
> upload *before* it has been completed. Make it possible to handle *big* > uploads without requiring uploaded file to fit the memory. Handle multiple
This was changed in PHP 4.2.0, the file uploading code was rewritten to not load the whole fie in memory. --Jani

Daniel Convissor

21 years ago
Hi: It would be nice if PHP could not get tripped up by "<?xml" tags when short_tags is on. http://bugs.php.net/bug.php?id=25987 --Dan
-- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

Ilia A.

21 years ago
Already included, you may have seen this feature used before, <?php :-) Ilia Daniel Convissor wrote:

Sara Golemon

21 years ago
>> It would be nice if PHP could not get tripped up by "<?xml" tags when >> short_tags is on. >> > Already included, you may have seen this feature used before, <?php :-) >
I gather he meant making the scanner intelligent enough to see that the <? is followed by 'xml' and just ignoring the fact that short open tags is on. I wouldn't expect to see it happen (or want it to), but if he wants it, here's a sloppy implementation: Index: Zend/zend_language_scanner.l =================================================================== RCS file: /repository/ZendEngine2/zend_language_scanner.l,v retrieving revision 1.131 diff -u -r1.131 zend_language_scanner.l --- Zend/zend_language_scanner.l 3 Aug 2005 13:30:54 -0000 1.131 +++ Zend/zend_language_scanner.l 27 Aug 2005 21:55:36 -0000 @@ -1379,6 +1379,12 @@ } } +<INITIAL>"<?xml"([ \t]|{NEWLINE}) { + zendlval->value.str.val = (char *) estrndup(yytext, yyleng); + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + return T_INLINE_HTML; +} <INITIAL>"<%="|"<?=" { if ((yytext[1]=='%' && CG(asp_tags)) || (yytext[1]=='?' && CG(short_tags))) {

Jani Taskinen

21 years ago
Let's just nuke all other opening tags than <?php and we're done. :) (-1000000 to adding <?xml in the scanner) --Jani On Sat, 27 Aug 2005, Sara Golemon wrote:
>>> It would be nice if PHP could not get tripped up by "<?xml" tags when >>> short_tags is on. >>> >> Already included, you may have seen this feature used before, <?php :-) >> > I gather he meant making the scanner intelligent enough to see that the <? is > followed by 'xml' and just ignoring the fact that short open tags is on. I > wouldn't expect to see it happen (or want it to), but if he wants it, here's a > sloppy implementation: > > Index: Zend/zend_language_scanner.l > =================================================================== > RCS file: /repository/ZendEngine2/zend_language_scanner.l,v > retrieving revision 1.131 > diff -u -r1.131 zend_language_scanner.l > --- Zend/zend_language_scanner.l 3 Aug 2005 13:30:54 -0000 1.131 > +++ Zend/zend_language_scanner.l 27 Aug 2005 21:55:36 -0000 > @@ -1379,6 +1379,12 @@ > } > } > > +<INITIAL>"<?xml"([ \t]|{NEWLINE}) { > + zendlval->value.str.val = (char *) estrndup(yytext, yyleng); > + zendlval->value.str.len = yyleng; > + zendlval->type = IS_STRING; > + return T_INLINE_HTML; > +} > > <INITIAL>"<%="|"<?=" { > if ((yytext[1]=='%' && CG(asp_tags)) || (yytext[1]=='?' && > CG(short_tags))) { > >
-- Donate @ http://pecl.php.net/wishlist.php/sniper

Johannes Schlueter

21 years ago
Hi Sara, On Sunday 28 August 2005 00:02, Sara Golemon wrote:
> +<INITIAL>"<?xml"([ \t]|{NEWLINE}) {
And what's with <?xml-stylesheet ?> or any other processing instruction? Even so others than xml are rarely used it would imho be a great wtf factor if <?xml is somehow special. At a sidenote: If you output xml you anyways neet to set the right content-type header, so either set default_mimetype to text/xml (or similar) and turn of short_open_tags in the php.ini or start the file with a header() call followed by an echo of the xml-pi. johannes

David Kingma - Jool.nl

21 years ago
Johannes Schlueter wrote:
>Hi Sara, > >On Sunday 28 August 2005 00:02, Sara Golemon wrote: > > >>+<INITIAL>"<?xml"([ \t]|{NEWLINE}) { >> >> > >And what's with <?xml-stylesheet ?> or any other processing instruction? Even >so others than xml are rarely used it would imho be a great wtf factor if ><?xml is somehow special. > >At a sidenote: If you output xml you anyways neet to set the right >content-type header, so either set default_mimetype to text/xml (or similar) >and turn of short_open_tags in the php.ini or start the file with a header() >call followed by an echo of the xml-pi. > >
If you replace the te following lines: <INITIAL>"<?"|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"\'php\'"){WHITESPACE}*">" { HANDLE_NEWLINES(yytext, yyleng); if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not <? but <script> */ with: <INITIAL>"<? "|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"\'php\'"){WHITESPACE}*">" { HANDLE_NEWLINES(yytext, yyleng); if (CG(short_tags) || yyleng>3) { /* yyleng>3 means it's not <? but <script> */ (notice the space behind '?' and the length check from 2 to 3) Wouldn't that fix the whole problem without creating a special case for <?xml ? David

Johannes Schlueter

21 years ago
Hi, David, On Sunday 28 August 2005 10:18, David Kingma | jool.nl wrote:
> If you replace the te following lines: > > <INITIAL>"<?"|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}* >("php"|"\"php\""|"\'php\'"){WHITESPACE}*">" { HANDLE_NEWLINES(yytext, > yyleng); > if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not <? but > <script> */ > > > with: > > <INITIAL>"<? > "|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"ph >p\""|"\'php\'"){WHITESPACE}*">" { HANDLE_NEWLINES(yytext, yyleng); > if (CG(short_tags) || yyleng>3) { /* yyleng>3 means it's not <? but > <script> */ > > > (notice the space behind '?' and the length check from 2 to 3) Wouldn't > that fix the whole problem without creating a special case for <?xml ?
Wouldn't that break <?my_great_Function(); ?>? johannes

Steph

21 years ago
Yep. I saw this happening during the PHP 5 coding contest we held last year at Zend - some people used short open tags so I had to have that 'on' in my php.ini to test, but having it 'on' screwed the entries that used XML, so I was forever switching short open tags off and on. I was supposed to prove that there was a problem in that area, at the time, having opened my mouth over this issue. <regret>I didn't actually make time to do so</regret> - but yes, I believe it's an issue. ----- Original Message ----- From: "Sara Golemon" <pollita@php.net> To: <internals@lists.php.net> Sent: Sunday, August 28, 2005 12:02 AM Subject: Re: [PHP-DEV] PHP 6.0 Wishlist
> >> It would be nice if PHP could not get tripped up by "<?xml" tags when > >> short_tags is on. > >> > > Already included, you may have seen this feature used before, <?php :-) > > > I gather he meant making the scanner intelligent enough to see that the <? > is followed by 'xml' and just ignoring the fact that short open tags is
on.

Paul Reinheimer

21 years ago
My prefrerence would be for the interpreter to look for "<?\w" when short tags is enabled (that was brace, question mark, white space), I don't think i've ever come across an instance when a space or line break wasn't used. I don't have a huge code repository handy but are there any good counter examples live? It seems that checking for whitespace (or the long tag) would resolve all of the <?xml* issues, while retaining the majority of BC, and hopefully allow PHP to do what it does best, work the way developers expect it to. paul On 8/27/05, Steph <steph@zend.com> wrote:
> Yep. I saw this happening during the PHP 5 coding contest we held last year > at Zend - some people used short open tags so I had to have that 'on' in my > php.ini to test, but having it 'on' screwed the entries that used XML, so I > was forever switching short open tags off and on. > > I was supposed to prove that there was a problem in that area, at the time, > having opened my mouth over this issue. > > <regret>I didn't actually make time to do so</regret> > > - but yes, I believe it's an issue. > > ----- Original Message ----- > From: "Sara Golemon" <pollita@php.net> > To: <internals@lists.php.net> > Sent: Sunday, August 28, 2005 12:02 AM > Subject: Re: [PHP-DEV] PHP 6.0 Wishlist > > > > >> It would be nice if PHP could not get tripped up by "<?xml" tags when > > >> short_tags is on. > > >> > > > Already included, you may have seen this feature used before, <?php :-) > > > > > I gather he meant making the scanner intelligent enough to see that the <? > > is followed by 'xml' and just ignoring the fact that short open tags is > on. > > I wouldn't expect to see it happen (or want it to), but if he wants it, > > here's a sloppy implementation: > > > > Index: Zend/zend_language_scanner.l > > =================================================================== > > RCS file: /repository/ZendEngine2/zend_language_scanner.l,v > > retrieving revision 1.131 > > diff -u -r1.131 zend_language_scanner.l > > --- Zend/zend_language_scanner.l 3 Aug 2005 13:30:54 -0000 > > 1.131 > > +++ Zend/zend_language_scanner.l 27 Aug 2005 21:55:36 -0000 > > @@ -1379,6 +1379,12 @@ > > } > > } > > > > +<INITIAL>"<?xml"([ \t]|{NEWLINE}) { > > + zendlval->value.str.val = (char *) estrndup(yytext, yyleng); > > + zendlval->value.str.len = yyleng; > > + zendlval->type = IS_STRING; > > + return T_INLINE_HTML; > > +} > > > > <INITIAL>"<%="|"<?=" { > > if ((yytext[1]=='%' && CG(asp_tags)) || (yytext[1]=='?' && > > CG(short_tags))) { > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >
-- Paul Reinheimer Zend Certified Engineer

Rasmus Lerdorf

21 years ago
Paul Reinheimer wrote:
> My prefrerence would be for the interpreter to look for "<?\w" when > short tags is enabled (that was brace, question mark, white space), I > don't think i've ever come across an instance when a space or line > break wasn't used. I don't have a huge code repository handy but are > there any good counter examples live?
Thousands. <?=$foo?> and <?echo $foo?> are both extremely common when injection single PHP variables into forms and general HTML sections. -Rasmus

Ron Korving

21 years ago
But why doesn't <?php=$foo ?> work? If that'd work, I just might start using <?php ?> Ron "Rasmus Lerdorf" <rasmus@lerdorf.com> wrote in message news:43114C03.1070902@lerdorf.com...

Cyprien Fulax Nicolas

21 years ago
Using <?php=$var ?> seems ridiculous, because it would be implemented only into current branches, so it would not bring compatibility with older releases... Moreover, instead of using <?=$var ?> for variable interpolation, I prefer to use the heredoc syntax, I think it's better for good looking and readable code. For that, I don't see any reason to create any new short_open_tag like config directive... Cyp Ron Korving wrote:

Ron Korving

21 years ago
It's unclear to me what the position of the big kahuna's is on the following issues, but I hope they can become a reality in PHP6: 1) named parameters. in user functions, but also in core functions: $result = in_array(needle: "foo", haystack: $array); 2) error reporting using exceptions. I would like it if I could catch PHP-errors and take appropriate action (such as logging it to a database or whatever). 3) doubling the precision of integers to 64 bits and floats to 128 bits. I know Wez wants this too, but will it happen? I think it would be nice if it would be a transparant change and the standard types would simply have a bigger range. 4) improved __toString behavior 5) Altered/improved garbage collection (see my recent post on leaking memory when throwing exceptions from a foreach() loop). Leaking memory may be perfectly fine in a webserver situation, but I personally use PHP a lot for cli-scripts (sometimes forever-running daemon applications). 6) Broader support for (custom) stream-wrappers (I noticed the zlib functions don't accept them). I wanted to make a stream wrapper for strings, so I could do this: readgzfile("str://andHereSomeGzipData").. In fact, if you ask me, such a str:// wrapper may be implemented as a standard wrapper. It would be useful in a lot more cases where functions read from files. Thanks, Ron

Marcus Börger

21 years ago
Hello Ron, Wednesday, August 31, 2005, 3:37:51 PM, you wrote:
> 2) error reporting using exceptions. > I would like it if I could catch PHP-errors and take appropriate action > (such as logging it to a database or whatever).
You can already do that with 5.1 by adding three lines of code.
> 4) improved __toString behavior
I'll take care of that asap.
> 6) Broader support for (custom) stream-wrappers (I noticed the zlib > functions don't accept them). I wanted to make a stream wrapper for strings, > so I could do this: readgzfile("str://andHereSomeGzipData").. In fact, if > you ask me, such a str:// wrapper may be implemented as a standard wrapper. > It would be useful in a lot more cases where functions read from files.
That might be the case because a) the underlying library does not allow this or because the extension isn't updated. In general all file functions should accept any stream. Maybe you need to look into the extension source yourself or contact the author/maintainer. Best regards, Marcus

Ron Korving

21 years ago
"Marcus Boerger" <helly@php.net> wrote in message news:361587231.20050831205522@marcus-boerger.de...
> Hello Ron, > > Wednesday, August 31, 2005, 3:37:51 PM, you wrote: > > > 2) error reporting using exceptions. > > I would like it if I could catch PHP-errors and take appropriate action > > (such as logging it to a database or whatever). > > You can already do that with 5.1 by adding three lines of code.
Sounds awesome.. is this documented (I don't mean the PHP manual) anywhere? I'm curious as to how this works.
> > 4) improved __toString behavior > > I'll take care of that asap.
You're my hero.
> > 6) Broader support for (custom) stream-wrappers (I noticed the zlib > > functions don't accept them). I wanted to make a stream wrapper for
strings,
> > so I could do this: readgzfile("str://andHereSomeGzipData").. In fact,
if
> > you ask me, such a str:// wrapper may be implemented as a standard
wrapper.
> > It would be useful in a lot more cases where functions read from files. > > That might be the case because a) the underlying library does not allow
this
> or because the extension isn't updated. In general all file functions
should
> accept any stream. Maybe you need to look into the extension source
yourself
> or contact the author/maintainer.
I looked into the source, but I'm I couldn't quite grasp the inner workings. I promised myself to get into more actively "developing" in this area, maybe apply for a CVS account in time... but that's gonna take some time. Where do I see who maintains a certain extension?
> Best regards, > Marcus
Thanks Marcus, Ron

Marcus Börger

21 years ago
Hello Ron, Wednesday, August 31, 2005, 9:02:37 PM, you wrote:
> "Marcus Boerger" <helly@php.net> wrote in message > news:361587231.20050831205522@marcus-boerger.de... >> Hello Ron, >> >> Wednesday, August 31, 2005, 3:37:51 PM, you wrote: >> >> > 2) error reporting using exceptions. >> > I would like it if I could catch PHP-errors and take appropriate action >> > (such as logging it to a database or whatever). >> >> You can already do that with 5.1 by adding three lines of code.
> Sounds awesome.. is this documented (I don't mean the PHP manual) anywhere? > I'm curious as to how this works.
Look for slide 42 in talk 'SPL for the masses' here: http://talks.somabo.de
>> > 4) improved __toString behavior >> >> I'll take care of that asap.
> You're my hero.
>> > 6) Broader support for (custom) stream-wrappers (I noticed the zlib >> > functions don't accept them). I wanted to make a stream wrapper for > strings, >> > so I could do this: readgzfile("str://andHereSomeGzipData").. In fact, > if >> > you ask me, such a str:// wrapper may be implemented as a standard > wrapper. >> > It would be useful in a lot more cases where functions read from files. >> >> That might be the case because a) the underlying library does not allow > this >> or because the extension isn't updated. In general all file functions > should >> accept any stream. Maybe you need to look into the extension source > yourself >> or contact the author/maintainer.
> I looked into the source, but I'm I couldn't quite grasp the inner workings. > I promised myself to get into more actively "developing" in this area, maybe > apply for a CVS account in time... but that's gonna take some time. Where do > I see who maintains a certain extension?
look into the EXTENSIONS file or in the head of any .h or .h file. marcus

Ron Korving

21 years ago
Hi,
> >> > 2) error reporting using exceptions. > >> > I would like it if I could catch PHP-errors and take appropriate
action
> >> > (such as logging it to a database or whatever). > >> > >> You can already do that with 5.1 by adding three lines of code. > > > Sounds awesome.. is this documented (I don't mean the PHP manual)
anywhere?
> > I'm curious as to how this works. > > Look for slide 42 in talk 'SPL for the masses' here:
http://talks.somabo.de Oh my god, I am so ashamed (hangs head between knees)... sorry.
> > I looked into the source, but I'm I couldn't quite grasp the inner
workings.
> > I promised myself to get into more actively "developing" in this area,
maybe
> > apply for a CVS account in time... but that's gonna take some time.
Where do
> > I see who maintains a certain extension? > > > look into the EXTENSIONS file or in the head of any .h or .h file. > > marcus
Thanks, Ron

Mike Bretz

20 years ago
The wishlist on PHP6 has grown a lot last weeks. Here is what I have missed so far: switchable behaviours in php.ini file: - enforced variable initialisation (throw E_ERROR where today E_NOTICE is triggered) - strict variable typing (This can be done with SetType already, but a nicer language construct as in other languages (I do not say "C" or "java" ;) would be nice) - automatic type conversions on|off And also I would like to see type checking on function parameters for simple types as "integer", "string" etc... Only having this for classes is not strict enough. Also an useful feature would be "const" on function parameters. just my €0.01 mike

Ron Korving

20 years ago
"Mike Bretz" <m.bretz@metropolis-ag.de> wrote in message news:43281520.4000209@metropolis-ag.de...
> Also an useful feature would be "const" on function parameters.
Hmm, I like that ;) That may even provide a performance increasing opportunity... I have another idea I came up with today: regular expression switches, but it would be difficult without adding to the syntax. switch ($str) { case "abc": echo "it was ABC!\n"; break; regcase "/^[0-9]+$/i": echo "it was a number!\n"; break; default: echo "it was no number :-(\n"; break; } Just an idea ;) Ron

James Crumpton

20 years ago
Can be done already ... sorta. switch (true) { case ($str == 'abc'): echo "it was ABC!\n"; break; case (preg_match('/^[0-9]+$/i', $str)): echo "it was a number!\n"; break; default: echo "it was no number :-(\n"; break; } *shrug* -james Ron Korving wrote:

Ron Korving

20 years ago
Funny solution :) Not very elegant I think (no offence, coz it is a smart one), but it works. It would be nice if the language provided it.. Another problem though with my idea (and not your solution) would be that a "regcase" would have the PHP syntax rely on an external library. Ron "James Crumpton" <james@safesearching.com> schreef in bericht news:4329E054.8070206@safesearching.com...
> Can be done already ... sorta. > > switch (true) { > case ($str == 'abc'): > echo "it was ABC!\n"; > break; > case (preg_match('/^[0-9]+$/i', $str)): > echo "it was a number!\n"; > break; > default: > echo "it was no number :-(\n"; > break; > } > > *shrug* > > -james > > Ron Korving wrote: > > I have another idea I came up with today: regular expression switches,
but

Hartmut Holzgraefe

20 years ago
Ron Korving wrote:
> I have another idea I came up with today: regular expression switches, but > it would be difficult without adding to the syntax.
no, its actually pretty easy from a syntax point of view, you don't need to add another keyword, just add an optional callback parameter to switch() which is a comparison function similar to what you pass to e.g. usort() that way you are not limited to one type of reges but could have ereg or preg style or could do other things like case insensitive switches: switch ($str, "ereg") { case "[[:alpha:]]+":... } switch ($str, "preg_match") { case "/^[A-Za-z]+$/": ... } switch ($str, "strcasecmp") { ... } or even function my_cmp($str1, $str2) { return strcmp(str_rev($str1, $str2)); } switch ($str, "my_cmp") ... i have looked into implementing that quite a while ago but hat to give up due to lack of time and understanding at that point in time though

Ron Korving

20 years ago
The problem with this would be that it can't be decided on a per-case basis, but only for the whole switch, which would make the execution slower. That's why I'd prefer a "regcase", but I guess this can be considered ugly becuase e.g. C(++) doesn't have a "regcase" either and it's quite a diversion from the known syntax. Ron "Hartmut Holzgraefe" <hartmut@php.net> schreef in bericht news:4329DEBE.3080204@php.net...
> Ron Korving wrote: > > I have another idea I came up with today: regular expression switches,
but

Kevin Waterson

20 years ago
This one time, at band camp, "Ron Korving" <r.korving@xit.nl> wrote:
> The problem with this would be that it can't be decided on a per-case basis, > but only for the whole switch, which would make the execution slower. That's > why I'd prefer a "regcase", but I guess this can be considered ugly becuase > e.g. C(++) doesn't have a "regcase" either and it's quite a diversion from > the known syntax.
Isnt all this taken care of with preg_match? Kevin
-- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote."

Ron Korving

20 years ago
You mean that preg_match() would match an ordinary string just fine? I wouldn't prefer that for performance reasons. I'd like to choose per case how I want the matching done (regexp or not). Ron "Kevin Waterson" <kevin@oceania.net> schreef in bericht news:20050916222119.222d03ea.kevin@oceania.net...
> This one time, at band camp, "Ron Korving" <r.korving@xit.nl> wrote: > > > The problem with this would be that it can't be decided on a per-case
basis,
> > but only for the whole switch, which would make the execution slower.
That's
> > why I'd prefer a "regcase", but I guess this can be considered ugly
becuase
> > e.g. C(++) doesn't have a "regcase" either and it's quite a diversion
from

Sebastian Bergmann

20 years ago
Rasmus Lerdorf schrieb:
> Include an opcode cache by default. A lot of work has gone into > pecl/apc recently, but I am not hung up on which one goes in.
In case we include APC by default, it would be nice if its apc_store() / apc_fetch() mechanism could be mapped to a new super-global, say $_PERSISTENT[].
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Jani Taskinen

20 years ago
On Sat, 22 Oct 2005, Sebastian Bergmann wrote:
> > Rasmus Lerdorf schrieb: >> Include an opcode cache by default. A lot of work has gone into >> pecl/apc recently, but I am not hung up on which one goes in. > > In case we include APC by default, it would be nice if its apc_store() / > apc_fetch() mechanism could be mapped to a new super-global, say > $_PERSISTENT[].
Containing what? What about those "round-robin" environments where you have several machines serving same web pages? --Jani

Sebastian Bergmann

20 years ago
Jani Taskinen schrieb:
> Containing what? What about those "round-robin" environments where > you have several machines serving same web pages?
You're right, what we really need is being able to introduce new super-globals through extensions (can we do this already?), so that the extensions that talk to SRM and memcached, for instance, can do the right thing.
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Jani Taskinen

20 years ago
On Sat, 22 Oct 2005, Sebastian Bergmann wrote:
> > Jani Taskinen schrieb: >> Containing what? What about those "round-robin" environments where >> you have several machines serving same web pages? > > You're right, what we really need is being able to introduce new > super-globals through extensions (can we do this already?), so that the
Yes we can do this already. See ext/session/ for one example. :) But I'd treat this kind of thing rather as part of session handling mechanism though. We had a short thread about this in the "wishlist" thread already so read that too. --Jani

Sebastian Bergmann

20 years ago
Jani Taskinen schrieb:
> But I'd treat this kind of thing rather as part of session handling > mechanism though. We had a short thread about this in the "wishlist" > thread already so read that too.
Ah, now I remember. Anyways, just wanted to make sure that this does not get forgotten ;-)
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

Andreas Korthaus

20 years ago
Jani Taskinen wrote:
> > On Sat, 22 Oct 2005, Sebastian Bergmann wrote: > >> Rasmus Lerdorf schrieb: >> >>> Include an opcode cache by default. A lot of work has gone into >>> pecl/apc recently, but I am not hung up on which one goes in. >> >> >> In case we include APC by default, it would be nice if its apc_store() / >> apc_fetch() mechanism could be mapped to a new super-global, say >> $_PERSISTENT[]. > > > Containing what?
A super-global like $_PERSISTENT could work like $_SESSION, with a similar "framework", but could store data which is NOT user-specific like session-data. So you have a very simple methode to store any variables/objects between HTTP-requests. If you use something like APC as backend, you will also get a fast methode to store/load variables/objects, which are not user-specific, and perhaps expensive to create/load (e.g. from a webservice, DB...). The problem with "several machines serving same web pages" is exactly the same you have with $_SESSION today. But the session extension provides means to work around this using a DB or memcached as backend. This could be copied by something like a "Persistance Framework". But many other PHP installations will have another problem you don't see with $_SESSION today: concurrency. That's because you don't have a unique session-ID anymore, so application1 can overwrite variables from application2, script1.php can overwrite variables from script1.php and on shared hosting setups user1 can overwrite variables from user2. That's also a security issue. So an application-ID has been a good idea, but if you have to define it by yourself, chances are that two users choose the same application-ID and applications will break. So perhaps you also have to find some other values, the users cannot control, to avoid concurrency issues. Perhaps make a $_PERSISTENT variable only available for the script which has created it (by saving the path too, but if you move/rename..., and not very flexible anymore). Best regards Andreas PS: I've read the discussion on this list before ;-)