Re: PHP_Compat, signature changes

From: Date: Sun, 29 May 2005 14:20:00 +0000
Subject: Re: PHP_Compat, signature changes
References: 1 2 3 4 5  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-37864@lists.php.net to get a copy of this message
Helgi Þormar wrote:
On Sat, 2005-05-28 at 14:20 -0400, Philippe Jausions wrote:
Stephan Schmidt wrote:
I don't think that this can be added in any useful way to PHP_Compat. As soon as you use a new name, it cannot be used with applications that do not know anything about PHP_Compat as they will always call the built-in function.
Packages that need to rely on the extra/new parameters of those functions would have a required dependency on PHP_Compat. Of course there is always the code-duplication solution, but if PHP_Compat has the functions (regression tested) then it would be a good place to look for code...
I must say, that's silly, if anything then I'd like to be able to just drop PHP_Compat someplace at the top of my application/framework and voila it just works for people on low PHP versions, not that I need to do some extra changing in my code. That just ... defeats the point of PHP_Compat.
And how do you do that, with your base PHP installation...? The point is the PHP function changed, so you have to wrap the new feature of the existing function into a new function to also make it available to older PHP versions. Let's say your (PHP5) code do something like that: <?php echo microtime(true); ?> Under PHP5 you would get: 1117375530.8131 Under PHP4 you would get: 0.81312100 1117375530 (Under my PHP 4.3.5 the interpretor wouldn't even complain about the extra parameter) Therefore it really is in PHP_Compat's scope. You're looking at getting a consistent result across various PHP versions. All this being said, your application will not be able to call the microtime() function directly. You are basically required to use a new function. You are neither breaking any existing application since you're introducing a new function. -Philippe

« previous php.pear.dev (#37864) next »