PHP 5.0.3 is losing $this. PHP 4.3.10 and 5.0.0 seem to work fine.
The bug originally appeared in 5.0.2.
I have submitted a bug report at:
I've not had alot of luck with reporting bugs through the bug tracker;
For instance see
where the guy claims PHP can't do recursion without crashing ... Ummm?
So I thought I'd try to ask here.
Unfortunately I've been unable to reproduce the 5.0.3 bug in just a few
lines. I do have a script that's in my mind pretty short and the meat of
it is only 8 lines long but it includes three classes needed to set up
the experiment.
More information is available at:
http://www.formvista.com/index.html?article_id=4
Direct link to the code:
http://www.formvista.com/uploaded_files/php5_drops_object.php.txt
Scroll to the bottom.
The code has three classes:
fv_basecomponent is a child of fv_basewidget is a child of fv_tree.
fv_baseComponent overrides a method in fv_basewidget called
&getParentControl(). fv_baseComponent::getParentControl() returns a
reference to $this.
In PHP 5.0.3 the reference returned is not an object and a nasty error
is generated. I've tested this using today's snapshot
(php5-STABLE-200503051730).
It continues to work like a champ in PHP 4.3.10 and every previous
version and like I said it used to work in 5.0.0.
Any help in tracking this down or devising a workaround would be greatly
appreciated.
And if anyone has any thoughts on bug http://bugs.php.net/31508 that
would be greatly appreciated as well; it's not quite the showstopper
than the 5.0.3 bug is, but is causing me serious headaches as well.
Thanks
-- Yermo
DTLink Software http://www.dtlink.com
Internet Business Systems and Software
Yermo Lamers wrote:
I've not had alot of luck with reporting bugs through the bug tracker;
For instance seewhere the guy claims PHP can't do recursion without crashing ... Ummm?
To be fair, he is correct in what he says; PHP cannot do recursion
beyond a certain level, because of limitations on stack size. He does
not claim that PHP cannot do recursion; you are misrepresenting him..
Yermo Lamers wrote:
I've not had alot of luck with reporting bugs through the bug tracker;
For instance seewhere the guy claims PHP can't do recursion without crashing ... Ummm?
To be fair, he is correct in what he says; PHP cannot do recursion
beyond a certain level, because of limitations on stack size. He does
not claim that PHP cannot do recursion; you are misrepresenting him..
Not to start a new thread but at this point in the conversation because
the PHP 5.0.3 bug is much more serious but in my own defense I was told:
"What you are experiencing is a stack smash caused by recurssion. This is
unlikely to ever be fixed and is a good example of why not to use
recursive functions."
Good example of why not to use recursive functions ... Ummm? I don't see
how I can misrepresent that.
You are correct that later in the conversation he corrected himself after
I replied. But to be fair I put alot of work into tracking this down this
far and it's a very serious bug that has nothing to do with recursion. It
just got dismissed out of hand; which is pretty much what has happened
with every bug report, every patch, etc that I've ever submitted going
back to PHP 4.0.
I certainly understand that there are countless bugs and thousands of
people with issues and very few of them are doing projects of the size and
scope that I am. In many ways, PHP is not an appropriate choice for my
project, but that's a separate subject. At the very least it would be nice
to not be dismissed out of hand; especially when I've taken the time to
clearly demonstrate an internal PHP buffer overrun error. I can't be the
only person experiencing these problems.
As far as I've been able to determine the PHP 4.3.10 bug is due to a
buffer overrun error having something to do with methods returning array
members and the caller incorrectly taking a reference to the returned
value ... 9 times out of 10 it makes the sit and spin/coredump problem go
away. If taking a a reference to a by-value is incorrect PHP it should
generate a warning. It seems to be correct since it'll work for the first
few hundred iterations .. and then randomnly crash depending on context,
which is why I haven't been able to produce a nice small script to
demonstrate it.
At least with --enable-debug turned on the coredump problems goes away and
it generates very nice buffer overrun errors.
Like I said, I haven't had much luck reporting bugs. No problem. I
understand they are very busy; and I'm willing to help if I can. But
showing no interest and dismissing serious bugs out of hand is a real
problem.
Right now the 4.3.10 bug isn't as critical as the 5.0.3 bug. That one's a
showstopper as the project I've been working on for the last 4 years (tens
of thousands of lines of code) can't run under 5.0 while this bug
persists.
Symbol table trashing bugs due to buffer management errors have plagued
PHP since the 4.0 days. I had held out hope they would be resolved in Zend
2; and I think the situation is improved but this "$this" getting lost
problem prevents me from upgrading.
What can I do to help to track these down and fix it/get them fixed?
-- Yermo
DTLink Software http://www.dtlink.com
Desktop Software and Web Applications
At least with --enable-debug turned on the coredump problems goes away and
it generates very nice buffer overrun errors.
Like I said, I haven't had much luck reporting bugs. No problem. I
understand they are very busy; and I'm willing to help if I can. But
showing no interest and dismissing serious bugs out of hand is a real
problem.
The problem you're having is not giving the right information. For
instance, the buffer overrun errors would be an ideal thing to attach
to your bug report.
Symbol table trashing bugs due to buffer management errors have plagued
PHP since the 4.0 days. I had held out hope they would be resolved in Zend
2; and I think the situation is improved but this "$this" getting lost
problem prevents me from upgrading.What can I do to help to track these down and fix it/get them fixed?
Write good bug reports. There is something of an art to it,
especially for the harder to pin-down problems. I just glanced
through your script, and the mere fact that you have to search for the
bug shows that the test script is too large.
The bottom line is that PHP is a free open source project, powered by
volunteers; show some respect for our free time by taking the time to
refine the report to the smallest possible test case.
--Wez.
The problem you're having is not giving the right information. For
instance, the buffer overrun errors would be an ideal thing to attach
to your bug report.
The buffer overruns are the separate bug in PHP 4 as in
http://bugs.php.net/31508.
The PHP 5 is not encountering a buffer overrun; it just loses $this.
Write good bug reports. There is something of an art to it,
especially for the harder to pin-down problems. I just glanced
through your script, and the mere fact that you have to search for the
bug shows that the test script is too large.
So what do you do when you can't reduce it down any further? I spent two
days putting that script together in a trial and error fashion until I
finally got something that seemed reasonably small in size.
It's 8 lines, not including the supporting classes; and those classes are
very simple.
There error it generates is completely obvious. "$this is not an object".
Hmm. how could that be?
It is entirely unreasonable to think that all bugs are going to be reduced
down to a few lines of code. Maybe if you're doing trivial things .. but
when dealing writing complicated systems it's often not so straight
forward.
The bottom line is that PHP is a free open source project, powered by
volunteers; show some respect for our free time by taking the time to
refine the report to the smallest possible test case.
I spent 16 hours producing that test case. It took countless runs. The
body of code that it comes from includes over 61,000 lines of code. You
see my problem.
If someone doesn't have enough time to at least look at it they could at
least point me in a direction so I can start delving into it. I understand
it's an open source project and I am trying to contribute where I can.
I'm not saying fix this for me. I'm saying "Where do I go next if I can't
produce the small script". The answer seems to be "you're out of luck".
Maybe the answer is "You need to pay someone to fix it", or "check out
this section of the parser yourself" or "try this patch" or "give us a
login and get on the phone with us and help us do this".
Some next step because I have to get this fixed.
The answer I keep getting is "oh well, we're too busy, you have no options
if you can't reproduce it in 20 lines".
-- Yermo
DTLink Software http://www.dtlink.com
Desktop Software and Web Applications