Re: foreach, assigning to a reference, and E_NOTICE

From: Date: Tue, 07 Mar 2006 05:24:03 +0000
Subject: Re: foreach, assigning to a reference, and E_NOTICE
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Can we throw an E_NOTICE when foreach targets a reference? (The other
there's many way to use reference, not only in foreach. don't do reference unless u know it's really needed. Sean's not so much referring to his own problem as (like you said) the solution is a fairly simple matter of following strict coding practices. He's trying to address the problem of unexperienced developers seeing this behavior and (wrongly) reporting it as a bug, or worse, assuming PHP is just "broken" and therefore shouldn't be used.
That said, I'm not convinved this needs a notice, but I'm certainly not against it. Perhaps we should split the difference with an E_STRICT. -Sara

Thread (10 messages)

« previous php.internals (#22164) next »