changed behavior: property of a string

php.internals

Daniel Convissor

21 years ago
Hi: Someone using PEAR DB just filed a bug report. It turns out PHP's behavior has changed when trying to find a "property" of a string: php -r "$str = 'Hello'; var_dump(isset($str->prop));" In 5.0.0, 5.0.1 and 5.0.2 it returns false. But in 5.0.3 it returns true. In a PHP 4 snapshot from today, it still returns false, as it always has. This behavior changed in HEAD some time between 2004-10-31 and 2004-12-16. --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

Daniel Convissor

21 years ago
On Sun, Dec 19, 2004 at 02:06:21PM -0500, Daniel Convissor wrote:
> > php -r "$str = 'Hello'; var_dump(isset($str->prop));"
Those on *nix like systems would probably rather use this: php -r '$str = "Hello"; var_dump(isset($str->prop));'
> In a PHP 4 snapshot from today, it still returns false, as it always has.
Uh, ignore that statement. Now that I think about it, my test used PHP 5, not 4. (PATH intercepted the command despite being in the php4 directory.) I'll test PHP 4 later. --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

Daniel Convissor

21 years ago
Hi: Someone mentioned http://bugs.php.net/bug.php?id=31098 deals with this issue. --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

Andi Gutmans

21 years ago
Will look into it. Thanks. At 02:06 PM 12/19/2004 -0500, Daniel Convissor wrote:

Andi Gutmans

21 years ago
We found the bug. Do you think this warrants a 5.0.4? Andi At 02:06 PM 12/19/2004 -0500, Daniel Convissor wrote:

Edin Kadribasic

21 years ago
I think there were a number of issues with 4.3.10/5.0.3 that warrant a speedy 4.3.11/5.0.4 (broken mssql, overload in php4, compilation issues on some platforms, etc.) Andi could you have a look at #31118 marked critical "Two consecutive foreach loops produce different results". Edin ----- Original Message ----- From: "Andi Gutmans" <andi@zend.com> To: "Daniel Convissor" <danielc@analysisandsolutions.com>; "PHP Internals List" <internals@lists.php.net> Sent: Wednesday, December 22, 2004 11:10 PM Subject: Re: [PHP-DEV] changed behavior: property of a string

Ilia A.

21 years ago
Of the common issues that are still unresolved there is also the apparent breakage of COM as of the new release. I'd like to address that before moving forward with .11. There are also some issues left with the strtod compilation, although the majority have been resolved by Jani. Ilia Edin Kadribasic wrote:

Adam Maccabee Trachtenberg

21 years ago
What about those pic changes? Did those ever make it in? I think that was a change slated for .10 that somehow missed it. Or am I remembering wrong? -adam On Wed, 22 Dec 2004, Ilia Alshanetsky wrote:
> Of the common issues that are still unresolved there is also the > apparent breakage of COM as of the new release. I'd like to address that > before moving forward with .11. There are also some issues left with the > strtod compilation, although the majority have been resolved by Jani. > > Ilia > > Edin Kadribasic wrote: > > I think there were a number of issues with 4.3.10/5.0.3 that warrant a > > speedy 4.3.11/5.0.4 (broken mssql, overload in php4, compilation issues on > > some platforms, etc.) > > > > Andi could you have a look at #31118 marked critical "Two consecutive > > foreach loops produce different results". > > > > Edin > > > > > > ----- Original Message ----- > > From: "Andi Gutmans" <andi@zend.com> > > To: "Daniel Convissor" <danielc@analysisandsolutions.com>; "PHP Internals > > List" <internals@lists.php.net> > > Sent: Wednesday, December 22, 2004 11:10 PM > > Subject: Re: [PHP-DEV] changed behavior: property of a string > > > > > > > >>We found the bug. Do you think this warrants a 5.0.4? > >> > >>Andi > > > > > >
-- 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!

Ilia A.

21 years ago
Pic changes didn't make it in unfortunately. I would love to have them in, but I have yet to see a refined patch everyone would be happy with. Ilia Adam Maccabee Trachtenberg wrote:

Derick Rethans

21 years ago
On Wed, 22 Dec 2004, Adam Maccabee Trachtenberg wrote:
> What about those pic changes? Did those ever make it in? I think that > was a change slated for .10 that somehow missed it. Or am I > remembering wrong?
Unfortunately they are not in, but IMO they should go into .11 and .4 Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Edin Kadribasic

21 years ago
> Of the common issues that are still unresolved there is also the > apparent breakage of COM as of the new release. I'd like to address that > before moving forward with .11.
Ok, thanks to Wez we can put this one into the solved list. So we have COM, overload, mssql working. Compilation is working on most oddball platforms now. Which platforms still report problems? Edin

Andi Gutmans

21 years ago
Am I right to assume COM is 4.3.x only? At 06:11 PM 12/22/2004 -0500, Ilia Alshanetsky wrote:

Ilia A.

21 years ago
Andi Gutmans wrote:
> Am I right to assume COM is 4.3.x only?
Yes, that is correct. But the problems (not present in prior versions) that appeared in an extension who's code didn't change one bit since previous release is probably a sign of other issues. Ilia

Edin Kadribasic

21 years ago
> Am I right to assume COM is 4.3.x only? >
Yes, php5's implementation is a complete re-write. Edin

Andi Gutmans

21 years ago
At 11:50 PM 12/22/2004 +0100, Edin Kadribasic wrote:
>Andi could you have a look at #31118 marked critical "Two consecutive >foreach loops produce different results".
Hi Edin, I looked into this problem. It's actually not a bug but just "weird" behavior as a result of PHP blocks not having scope. Basically the first foreach() statement leaves the value variable ($v) as a reference. When the second loop runs, it "assigns" the current array's position to $v. Because $v was a reference it'll actually overwrite the previously pointed to value. Now we can't go and unset($v) at the end of the foreach() statement as I bet there are many applications out there that take advantage of the last value staying in the $v variable after the foreach() finishes. The only thing I have in mind is possible emitting an E_STRICT during the foreach() loop if the loop value variable is a reference. However, just from looking at make test this might potentially break many scripts which are using E_STRICT and/or confuse their authors. Not sure how to weight that, and as we haven't had many complaints about this behavior I'm not sure it's worth it. Andi