Rasmus Lerdorf wrote: > Lukas Smith wrote: > >>Stanislav Malyshev wrote: >> >> >>>I wonder what was the original purpose of PHP5 emitting warning when >>>seeing 'var'? What are you basically saying now is "I want PHP4 code >>>that wouldn't have messages on my class vars if run in PHP5". But I'm >>>sure there was some idea behind these warnings, not? >> >> >>There was a reason. So that people who mark things "var" because there >>was no true PPP available will be notified that they are using >>deprecated syntax. To quote Andi "It was meant to help people find var's >>so that they can be explicit about the access modifiers." >> >>So to me it seems if I have no private/protected, but only public >>properties I would like to be able to preempt a needless warning as I >>migrade to PHP5. >> >>I dont agree however we should make protected and private simply behave >>as var in PHP 4.x as this would indeed just undermine the entire point >>of the E_STRICT warning. > > > Right. To me PHP4 OO code with explicit var declarations are public > declarations, because that is what var means. I find most code I look > at that has something that the developer might want to make private in > PHP5 are not explicitly declared with var. > > Of course, I am not actually seeing this warning right now, so maybe > this has gone away? Or what am I missing? > > error_reporting(E_ALL|E_STRICT); > ini_set('display_errors',1); > > class foo { > var $prop; > function foo($arg) { > $this->_private = $arg; > $this->prop = $this->_private * 10; > } > } > $a = new foo(14); > echo $a->prop; > > I am not seeing an E_STRICT from this.
Uh, never mind, I had restarted the Apache. Of course you need this in your php.ini to catch compile-time stuff. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php