Gallery2:PHP Version - Gallery Codex
Personal tools

Gallery2:PHP Version

From Gallery Codex

Gallery 2.2 will raise the minimum PHP version from 4.1.0 to 4.3.0.
Here is a report of how this changes the PHP functions we can use in G2 development.

Now Allowed

UNIQ91aa21a868495311-toggle-00000000-QINU

Second parameter (return) for print_r was added in PHP 4.3.0
Third parameter (timeout) for ftp_connect was added in PHP 4.2.0
Fifth parameter (resumepos/startpos) for ftp_get/ftp_fget/ftp_put/ftp_fput were added in PHP 4.3.0
Third parameter (recursive) for ftp_rawlist was added in PHP 4.3.0
Second parameter (level) for gzencode was added in PHP 4.2.0
File upload error codes became constants in PHP 4.3.0

Illegal Functions

UNIQ91aa21a868495311-toggle-00000001-QINU

Second parameter (connection) for sybase_set_message_handler was added in PHP 4.3.5
Support for JPC, JP2, JPX, JB2, XBM, and WBMP with exif_imagetype was added in PHP 4.3.2

UNIQ91aa21a868495311-toggle-00000002-QINU

Second parameter (autoload) for class_exists was added in PHP 5
The limit parameter for explode can only be negative in PHP 5.1
Third parameter (context) and fourth/fifth (offset, maxlen) for file_get_contents were added in PHP 5 and 5.1
First parameter (categorize) for get_defined_constants was added in PHP 5
Fourth parameter (ignore_transparent) for imagerotate was added in PHP 5.1
Second parameter (raw_output) for md5/md5_file was added in PHP 5
First parameter (get_as_float) for microtime was added in PHP 5
Third/fourth parameters (recursive, context) for mkdir were added in PHP 5
Seventh parameter (is_dst) for mktime is deprecated as of PHP 5.1
Fifth parameter (count) for preg_replace was added in PHP 5.1
Fourth/fifth/sixth parameters (cwd, env, other_options) for proc_open were added in PHP 5
Third parameter (step) for range was added in PHP 5
Second parameter (error_types) for set_error_handler was added in PHP 5
Second parameter (raw_output) for sha1/sha1_file was added in PHP 5
Third parameter (charlist) for str_word_count was added in PHP 5.1
Third/fourth parameters (offset, length) for substr_count were added in PHP 5.1

UNIQ91aa21a868495311-toggle-00000003-QINU

UNIQ91aa21a868495311-toggle-00000004-QINU

Other

As of PHP 5.1, strtotime returns false on failure instead of -1
As of PHP 5, objects with no properties are no longer considered empty
As of PHP 5, object assignment/parameters work differently.


UNIQ91aa21a868495311-toggle-00000005-QINU


Reports generated with these commands, then more greps:

GET 'http://us2.php.net/manual/en/index.functions.php' | sed -n -e '/^CLASS="index"/,/^<div id="usernotes">/ s/^HREF="\(.*\)".*$/\1/p' > urilist.txt
cat urilist.txt | perl -e 'use LWP::Simple qw(get);while(<>){$f=get "http://us2.php.net/manual/en/$_";$x=$y=0;foreach (split(/\n/,$f)){$x=1,next if /^NAME="function/;if($x and m#^>(.+)</#){if($y){($z=$1)=~s/&#62;/>/g;$z=~s/&#60;/</g;printf "%30s%s\n",$y,$z;last}$y=$1}}}' > funclist.txt
find . -name "*.inc" -o -name "*.class" -o -name "*.php" | php -r '$x=file("urilist.txt");function x($a){return rtrim(preg_replace("/function.(.*).php/e",'\''strtr("$1","-","_")'\'',$a));}$x=array_flip(array_map("x",$x));while(!feof(STDIN)){$y=rtrim(fgets(STDIN));$z=file_get_contents($y);preg_match_all("/([a-zA-Z_]+)\\(/",$z,$m);foreach($m[1] as $f){$f=strtolower($f);if(isset($x[$f])){$o[$f]++;}}}ksort($o);foreach($o as $f=>$c){printf("%33s  %d\n",$f,$c);}'