Reply to Re: __contruct in php4 not same behavior as php5

Your name:

Reply:


Posted by Oliver Grδtz on 11/22/07 10:29

FFMG schrieb:
> Oliver GrΓ€tz;104701 Wrote:
>> FFMG schrieb:
>>> I am slowly moving my code to php5.
>> Hurry up! http://gophp5.org/
>>
> Last I checked this is still my server :)

You didn't know they put self destruct time bombs into the binaries?
Just kidding. Still relying on PHP4 may still be OK after the "end of
life" but it'll potentially become dangerous to use it once any new
security holes like buffer overflow vulnerabilities are discovered.
There will be no one to fix them and thus hosting companies will start
to take PHP4 from their servers once that arises. This will be the
moment of death for applications that rely on PHP4 and need to be
deployed onto those public hosting services.

>> Do not touch the PHP4 style constructors until you
>> finally stop supporting PHP4 in your application.
>
> Well, according to
> http://www.php.net/manual/en/language.oop5.decon.php,
>
> "For backwards compatibility, if PHP 5 cannot find a __construct()
> function for a given class, it will search for the old-style
> constructor function, by the name of the class."
>
> In other words, the way I read this,
>
>> function TestClass() // For php4
>> {
>> $this->__construct();
>> ...
>
> will never be called in php5 because __construct() exists, so it is
> truly for backward compatibility.

Or you could say it is just for creating work out of nothing and it
bears the risk of changing one of them (other parameters) and forgetting
the other one. The "backwards compatibility" thing is already done by
PHP as the documentation clearly states and you are trying to outsmart
the language by double-solving the issue. My advice is to leave them
constructors alone until you finally switch the app to PHP5-only. And
then you don't need the backward compatibility...

OLLi

--
If he moves, kill him.
[Battlestar Galactica 2003, Pilot]

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация