3 * compatibility functions
5 * This file contains a few functions that might be missing from the PHP build
8 if(!function_exists('ctype_space')) {
10 * Check for whitespace character(s)
16 function ctype_space($text) {
17 if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars
18 if(trim($text) === '') return true;
23 if(!function_exists('ctype_digit')) {
25 * Check for numeric character(s)
31 function ctype_digit($text) {
32 if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars
33 if(preg_match('/^\d+$/', $text)) return true;
38 if(!function_exists('gzopen') && function_exists('gzopen64')) {
40 * work around for PHP compiled against certain zlib versions #865
42 * @link http://stackoverflow.com/questions/23417519/php-zlib-gzopen-not-exists
44 * @param string $filename
46 * @param int $use_include_path
49 function gzopen($filename, $mode, $use_include_path = 0) {
50 return gzopen64($filename, $mode, $use_include_path);
54 if(!function_exists('gzseek') && function_exists('gzseek64')) {
56 * work around for PHP compiled against certain zlib versions #865
58 * @link http://stackoverflow.com/questions/23417519/php-zlib-gzopen-not-exists
65 function gzseek($zp, $offset, $whence = SEEK_SET
) {
66 return gzseek64($zp, $offset, $whence);
70 if(!function_exists('gztell') && function_exists('gztell64')) {
72 * work around for PHP compiled against certain zlib versions #865
74 * @link http://stackoverflow.com/questions/23417519/php-zlib-gzopen-not-exists
79 function gztell($zp) {