Hello internals,
the patch implements __toString to have obejcts be automatically converted
to strings anywhere a string is requested. We have talked a lot about this
in the past and during OSCON Andi agreed again on it and said that the HEAD
version of the engine should be ready for it now. Futher more we have enough
time to fix any outstanding engine issues regarding this.
http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit the patch early
in the week.
The patch is a little big longer because it ensures that __toString gets
treated and especially gets cached just like any other magic function is.
Best regards,
Marcus
Give me a couple of days to review the patch itself.
I think we should then commit to HEAD, and see how it goes. There's
hopefully enough time in the PHP 6 process to validate that this kind
of patch doesn't hit any conceptual problems re: propagating to
pre-compile/post-shutdown execution stages...
Andi
At 05:36 AM 9/25/2005, Marcus Boerger wrote:
Hello internals,
the patch implements __toString to have obejcts be automatically converted
to strings anywhere a string is requested. We have talked a lot about this
in the past and during OSCON Andi agreed again on it and said that the HEAD
version of the engine should be ready for it now. Futher more we have enough
time to fix any outstanding engine issues regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit the patch early
in the week.The patch is a little big longer because it ensures that __toString gets
treated and especially gets cached just like any other magic function is.Best regards,
Marcus
Hello Andi,
i don't see your point here. We've discussed this tons of times. Either fix
the engine if you know it's broken, show us a real problem with the pacth or
accept the fact that we want to make progress here. Blocking patches because
they have a slight potential in causing some problems without telling about
the problems and coming up with some test script doesn't help anybody here.
You are just waisting my time with that. All other who saw the patch agreed to
it already.
marcus
Sunday, September 25, 2005, 6:31:59 PM, you wrote:
Give me a couple of days to review the patch itself.
I think we should then commit to HEAD, and see how it goes. There's
hopefully enough time in the PHP 6 process to validate that this kind
of patch doesn't hit any conceptual problems re: propagating to
pre-compile/post-shutdown execution stages...
Andi
At 05:36 AM 9/25/2005, Marcus Boerger wrote:
Hello internals,
the patch implements __toString to have obejcts be automatically converted
to strings anywhere a string is requested. We have talked a lot about this
in the past and during OSCON Andi agreed again on it and said that the HEAD
version of the engine should be ready for it now. Futher more we have enough
time to fix any outstanding engine issues regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit the patch early
in the week.The patch is a little big longer because it ensures that __toString gets
treated and especially gets cached just like any other magic function is.
Marcus,
I think you misread my email.
I said that it should be commited. I did want an additional two
days to review because we did have feedback for the patch (as you
saw). I don't know who "All others" are, but I don't know many who
can understand this patch to the lowest level of details.
So I don't know where you got the idea of blocking. Let me quote
myself "I think we should then commit to HEAD"...
That said, although many are trigger happy, I am noting that
architecturally, this has far reach implications (it will reach
everyplace in the engine which does a convert_to_() etc.). I
apologize that I can't pinpoint a precise problem right now (such as
convert_to_ being called after dtors are called). All I tried to say
is that we have to be aware that this is a very sensitive area to
change and there is a good chance we might bump into problems.
So as I said in the conference and in my email, I'm not against
progress, I am just stating we need some time to make sure that it's
indeed progress and doesn't regress us into trouble. That's why we
need (and have) enough time to make sure things don't break ala
exceptions not propagating everywhere or changing behavior of return
by reference. One problem I pointed out which had to do with
exceptions not propagating from __toString() was very valid, and we
agreed to not allow it (did you actually implement that part of the
discussion?).
Believe me, from a usability perspective, I think __toString()
working automagically is very nice... I'm just being less trigger
happy and want to make sure we're covered.
Andi
At 10:05 AM 9/25/2005, Marcus Boerger wrote:
Hello Andi,
i don't see your point here. We've discussed this tons of times. Either fix
the engine if you know it's broken, show us a real problem with the pacth or
accept the fact that we want to make progress here. Blocking patches because
they have a slight potential in causing some problems without telling about
the problems and coming up with some test script doesn't help anybody here.
You are just waisting my time with that. All other who saw the patch agreed to
it already.marcus
Sunday, September 25, 2005, 6:31:59 PM, you wrote:
Give me a couple of days to review the patch itself.
I think we should then commit to HEAD, and see how it goes. There's
hopefully enough time in the PHP 6 process to validate that this kind
of patch doesn't hit any conceptual problems re: propagating to
pre-compile/post-shutdown execution stages...Andi
At 05:36 AM 9/25/2005, Marcus Boerger wrote:
Hello internals,
the patch implements __toString to have obejcts be
automatically converted
to strings anywhere a string is requested. We have talked a lot about this
in the past and during OSCON Andi agreed again on it and said that the HEAD
version of the engine should be ready for it now. Futher more we
have enough
time to fix any outstanding engine issues regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit the
patch early
in the week.The patch is a little big longer because it ensures that __toString gets
treated and especially gets cached just like any other magic function is.
Hello Andi,
the excepton part is not in it jet but i'll do it (or dmitry can do it
easily). However i don't see a point here. And i don't see a point in your
dtors either. If anything that happens with the current implementation of
the patch is wrong then either it is an edgecase we have to fix or it would
have happened with __get/__set/__call as well which use the exact same
ideas besides the fact that they are called for different reasons of course.
That said i again don't see any reason to wait unless someone can show
something that is causing a real problem and not something that eventually
might effect some unknown parts in a way that theoretically might be bad.
p.s.: you often enough said gimme some time and we just lost things.
Tuesday, September 27, 2005, 2:17:55 AM, you wrote:
Marcus,
I think you misread my email.
I said that it should be commited. I did want an additional two
days to review because we did have feedback for the patch (as you
saw). I don't know who "All others" are, but I don't know many who
can understand this patch to the lowest level of details.
So I don't know where you got the idea of blocking. Let me quote
myself "I think we should then commit to HEAD"...
That said, although many are trigger happy, I am noting that
architecturally, this has far reach implications (it will reach
everyplace in the engine which does a convert_to_() etc.). I
apologize that I can't pinpoint a precise problem right now (such as
convert_to_ being called after dtors are called). All I tried to say
is that we have to be aware that this is a very sensitive area to
change and there is a good chance we might bump into problems.
So as I said in the conference and in my email, I'm not against
progress, I am just stating we need some time to make sure that it's
indeed progress and doesn't regress us into trouble. That's why we
need (and have) enough time to make sure things don't break ala
exceptions not propagating everywhere or changing behavior of return
by reference. One problem I pointed out which had to do with
exceptions not propagating from __toString() was very valid, and we
agreed to not allow it (did you actually implement that part of the
discussion?).
Believe me, from a usability perspective, I think __toString()
working automagically is very nice... I'm just being less trigger
happy and want to make sure we're covered.
Andi
At 10:05 AM 9/25/2005, Marcus Boerger wrote:
Hello Andi,
i don't see your point here. We've discussed this tons of times. Either fix
the engine if you know it's broken, show us a real problem with the pacth or
accept the fact that we want to make progress here. Blocking patches because
they have a slight potential in causing some problems without telling about
the problems and coming up with some test script doesn't help anybody here.
You are just waisting my time with that. All other who saw the patch agreed to
it already.marcus
Sunday, September 25, 2005, 6:31:59 PM, you wrote:
Give me a couple of days to review the patch itself.
I think we should then commit to HEAD, and see how it goes. There's
hopefully enough time in the PHP 6 process to validate that this kind
of patch doesn't hit any conceptual problems re: propagating to
pre-compile/post-shutdown execution stages...Andi
At 05:36 AM 9/25/2005, Marcus Boerger wrote:
Hello internals,
the patch implements __toString to have obejcts be
automatically converted
to strings anywhere a string is requested. We have talked a lot about this
in the past and during OSCON Andi agreed again on it and said that the HEAD
version of the engine should be ready for it now. Futher more we
have enough
time to fix any outstanding engine issues regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit the
patch early
in the week.The patch is a little big longer because it ensures that __toString gets
treated and especially gets cached just like any other magic function is.
I'd like to do some tests of the new __toString functionality but it
seems that it is committed only in PHP6-CVS branch. Is there a way to
get a windows binary snapshot for this branch?
http://ftp.emini.dk/pub/php/win32/php6/
Edin
Marian Kostadinov wrote:
I'd like to do some tests of the new __toString functionality but it
seems that it is committed only in PHP6-CVS branch. Is there a way to
get a windows binary snapshot for this branch?
Hello Edin,
cool, thanks!
marcus
Wednesday, September 28, 2005, 10:52:00 PM, you wrote:
Edin
Marian Kostadinov wrote:
I'd like to do some tests of the new __toString functionality but it
seems that it is committed only in PHP6-CVS branch. Is there a way to
get a windows binary snapshot for this branch?
Best regards,
Marcus
Hello All,
Was this actually added into PHP? Can anyone confirm if PHP's toString()
magic method will work everywhere a string is used (aka printf, switch,
etc)? If so, will this be possibly available in the 5.1x branch (since it's
sorta a bug/consistency fix) or will it only make it into the next major
release?
-Jeremy
Hello Edin,
cool, thanks!
marcus
Wednesday, September 28, 2005, 10:52:00 PM, you wrote:
Edin
Marian Kostadinov wrote:
I'd like to do some tests of the new __toString functionality but it
seems that it is committed only in PHP6-CVS branch. Is there a way to
get a windows binary snapshot for this branch?Best regards,
Marcus--
--
Jeremy Johnstone
http://www.jeremyjohnstone.com
jsjohnst@php.net
Hello Jeremy,
it is supposed to work everywhere in head and will be available in 5.2.
regards
marcus
Friday, January 27, 2006, 12:54:28 AM, you wrote:
Hello All,
Was this actually added into PHP? Can anyone confirm if PHP's toString()
magic method will work everywhere a string is used (aka printf, switch,
etc)? If so, will this be possibly available in the 5.1x branch (since it's
sorta a bug/consistency fix) or will it only make it into the next major
release?
-Jeremy
Hello Edin,
cool, thanks!
marcus
Wednesday, September 28, 2005, 10:52:00 PM, you wrote:
Edin
Marian Kostadinov wrote:
I'd like to do some tests of the new __toString functionality but it
seems that it is committed only in PHP6-CVS branch. Is there a way to
get a windows binary snapshot for this branch?Best regards,
Marcus--
--
Jeremy Johnstone
http://www.jeremyjohnstone.com
jsjohnst@php.net
Best regards,
Marcus
Marcus Boerger wrote:
Hello Jeremy,
it is supposed to work everywhere in head and will be available in 5.2.
Is there a generic way (for extensions, of course) to override the operators
between objects implementing __toString()?
See, I have two objects:
$o1 = new QString("php");
$o2 = new QString("-internals");
Now I could do:
$result = $o1->operator+=($o2);
better would be:
$result = $o1 .= $o2;
should result in "php-internals"
Can I modify the object structure in any way to register my own operator
functions which can be called by the engines execution unit? I found only
hard-wired implementations of that if I looked into the 'zend execute' code
or maybe I'm wrong. Ideally there would be something like a pointer in every
zval which points to a struct or table of 'operator-function pointers'. In
this case I could override it and point to another operator-function pointer
table. Ok, I can dream ;-)
In the current implementation (php 5.1) a function zend_make_printable' is
called, and there zend_std_cast_object_tostring. This means that the objects
__toString() result will be passed to the underlying system, and there is no
unicode support yet. What I would prefer is calling overidden operators
before __toString() is called.
Am I wrong? Can anybody help me please?
Thanks,
Thomas
Thomas Moenicke wrote:
[snip]
Is there a generic way (for extensions, of course) to override the operators
between objects implementing __toString()?
[snip]
The pecl package 'operator' (http://pecl.php.net/package/operator)
sounds like what you might be looking for.
Cheers!,
--
Carl
Carl P. Corliss wrote on Freitag, 27. Januar 2006 16:27:
The pecl package 'operator' (http://pecl.php.net/package/operator)
sounds like what you might be looking for.
Wow, great! All I have to do is to implement a __assign_concat() method?
Incredible!
Thank you, thanks to Sara!
Why this is not in the core? And what is 'Plan A'? ;)
regards,
Thomas
The pecl package 'operator' (http://pecl.php.net/package/operator)
sounds like what you might be looking for.Wow, great! All I have to do is to implement a __assign_concat() method?
Yep, atm you can refer to the test files included in the package (no other
docs yet).
Patrick also blogged up a nice summary:
http://blog.ghostwhowalksinside.org/archives/2006/programming/php/operator-magic
which includes objectified string handling and one particularly frightening
use of the mod operator...
Why this is not in the core?
Because PHP is not C++ :) Not to mention this is about two weeks old and
very experimental. :)
And what is 'Plan A'? ;)
There are two ways to ask an object for a property. Either is sufficient for
operator's needs, but the first version is preferred since it's less likely
to cause an unnecessary duplication.
-Sara
Marcus, you are my hero :)
Will it end up in 5.1?
Ron
"Marcus Boerger" helly@php.net wrote in message
news:1728334199.20050925143657@marcus-boerger.de...
Hello internals,
the patch implements __toString to have obejcts be automatically
converted
to strings anywhere a string is requested. We have talked a lot about this
in the past and during OSCON Andi agreed again on it and said that the
HEAD
version of the engine should be ready for it now. Futher more we have
enough
time to fix any outstanding engine issues regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit the patch
early
in the week.The patch is a little big longer because it ensures that __toString gets
treated and especially gets cached just like any other magic function is.Best regards,
Marcus
Nope, it's too far-reaching for it to make it into 5.1. It will take
some time to be sure that it doesn't screw up anyplace (similar to
the infamous shutdown problems)...
At 10:46 AM 9/25/2005, Ron Korving wrote:
Marcus, you are my hero :)
Will it end up in 5.1?Ron
"Marcus Boerger" helly@php.net wrote in message
news:1728334199.20050925143657@marcus-boerger.de...Hello internals,
the patch implements __toString to have obejcts be automatically
converted
to strings anywhere a string is requested. We have talked a lot about this
in the past and during OSCON Andi agreed again on it and said that the
HEAD
version of the engine should be ready for it now. Futher more we have
enough
time to fix any outstanding engine issues regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit the patch
early
in the week.The patch is a little big longer because it ensures that __toString gets
treated and especially gets cached just like any other magic function is.Best regards,
Marcus
Hello Ron,
no, we declined it for 5.1 becasue it was to late in release process
when we (i) rememebred it....so blame me for not having it in 5.1, or blame
yourself for not reminding us :-)
regards
marcus
Sunday, September 25, 2005, 7:46:09 PM, you wrote:
Marcus, you are my hero :)
Will it end up in 5.1?
Ron
"Marcus Boerger" helly@php.net wrote in message
news:1728334199.20050925143657@marcus-boerger.de...Hello internals,
the patch implements __toString to have obejcts be automatically
converted
to strings anywhere a string is requested. We have talked a lot about this
in the past and during OSCON Andi agreed again on it and said that the
HEAD
version of the engine should be ready for it now. Futher more we have
enough
time to fix any outstanding engine issues regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit the patch
early
in the week.The patch is a little big longer because it ensures that __toString gets
treated and especially gets cached just like any other magic function is.Best regards,
Marcus
Best regards,
Marcus
I knew I had forgotten something ;)
Ron
"Marcus Boerger" helly@php.net wrote in message
news:899874576.20050925203300@marcus-boerger.de...
Hello Ron,
no, we declined it for 5.1 becasue it was to late in release process
when we (i) rememebred it....so blame me for not having it in 5.1, or
blame
yourself for not reminding us :-)regards
marcusSunday, September 25, 2005, 7:46:09 PM, you wrote:
Marcus, you are my hero :)
Will it end up in 5.1?Ron
"Marcus Boerger" helly@php.net wrote in message
news:1728334199.20050925143657@marcus-boerger.de...Hello internals,
the patch implements __toString to have obejcts be automatically
converted
to strings anywhere a string is requested. We have talked a lot about
this
in the past and during OSCON Andi agreed again on it and said that the
HEAD
version of the engine should be ready for it now. Futher more we have
enough
time to fix any outstanding engine issues regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit the patch
early
in the week.The patch is a little big longer because it ensures that __toString
gets
treated and especially gets cached just like any other magic function
is.Best regards,
MarcusBest regards,
Marcus
Hi Marcus,
This is improved version of your patch.
It breaks only two tests those must be changed. (instead of > 10 those
shouldn't)
Please review.
Thanks. Dmitry.
-----Original Message-----
From: Marcus Boerger [mailto:helly@php.net]
Sent: Sunday, September 25, 2005 4:37 PM
To: internals
Subject: [PHP-DEV] [PATCH] __toString()Hello internals,
the patch implements __toString to have obejcts be
automatically converted to strings anywhere a string is
requested. We have talked a lot about this in the past and
during OSCON Andi agreed again on it and said that the HEAD
version of the engine should be ready for it now. Futher more
we have enough time to fix any outstanding engine issues
regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit
the patch early in the week.The patch is a little big longer because it ensures that
__toString gets treated and especially gets cached just like
any other magic function is.Best regards,
Marcus
Hello Dmitry,
looks good
Monday, September 26, 2005, 8:55:30 PM, you wrote:
Hi Marcus,
This is improved version of your patch.
It breaks only two tests those must be changed. (instead of > 10 those
shouldn't)
Please review.
Thanks. Dmitry.
-----Original Message-----
From: Marcus Boerger [mailto:helly@php.net]
Sent: Sunday, September 25, 2005 4:37 PM
To: internals
Subject: [PHP-DEV] [PATCH] __toString()Hello internals,
the patch implements __toString to have obejcts be
automatically converted to strings anywhere a string is
requested. We have talked a lot about this in the past and
during OSCON Andi agreed again on it and said that the HEAD
version of the engine should be ready for it now. Futher more
we have enough time to fix any outstanding engine issues
regarding this.http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt
If nobody objects with a real technical issue i'll commit
the patch early in the week.The patch is a little big longer because it ensures that
__toString gets treated and especially gets cached just like
any other magic function is.