Re: PHP_Compat

From: Date: Sat, 19 Jun 2004 18:50:16 +0000
Subject: Re: PHP_Compat
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30922@lists.php.net to get a copy of this message
Hi Aidan Lister! On 06/19/04 05:25 you wrote:
I have a bunch of functions people have requested I add, these are: * ob_clean * ob_flush * ob_get_clean * ob_get_flush * array_search * array_key_exists * constant * call_user_func_array And, replica superglobals.
There are a couple of problems. The ob_ functions don't exactly replicate the behaviour (not possible), and the other functions are very old (4.0.4+). Should they still be added?
Why not? It's PHP_Compat, so make it provide compatibillity.
With the superglobals - should they be added as an "environment" component? Would this open the door to all sorts of things, like magic_quotes off, etc? Is this a bad thing?
Not in my eyes.
So, what I ask: Should the ob functions get added?
+1
Should the very old functions get included? Thus, should the minimum replication version be lowered to say 4.0.0?
+1
Should a new class of components be added - environment compatibility?
+1 I've also an addition for PHP_Compat, which does not really add a compatibility function, but solves a very nasty issue of (AFAIK) all PHP versions: array_merge(). The array_merge function does not provide the functionality one would expect and (AFAIK) how it is documented. I once copied this little function from Lukas which implements the desired functionality: <snip>
    function array_merge_private ( $arr1, $arr2 ) {
        if (!is_array($arr1) || !is_array($arr2)) {
            return false;
        }
        foreach ($arr2 as $k => $v) {
            if (is_array($v) && isset($arr1[$k]) && is_array($arr1[$k]))
            {
                $arr1[$k] = array_merge_private($arr1[$k], $v);
            } else {
                $arr1[$k] = $v;
            }
        }
        return $arr1;
    }
</snip> Another cool idea for the package would be a method PHP_Compat::auto(); which would then examn the environment and load all not available feature. Regards, Toby -- Tobias Schlitt GPG Key: 0xA6529579 a passion for php http://www.schlitt.info

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