Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compatibility functions for missing ctype extension FS#2873
- Loading branch information
1 parent
9269d0b
commit 6589c60
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* compatibility functions | ||
* | ||
* This file contains a few functions that might be missing from the PHP build | ||
*/ | ||
|
||
if(!function_exists('ctype_space')) { | ||
/** | ||
* Check for whitespace character(s) | ||
* | ||
* @see ctype_space | ||
* @param string $text | ||
* @return bool | ||
*/ | ||
function ctype_space($text) { | ||
if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars | ||
if(trim($text) === '') return true; | ||
return false; | ||
} | ||
} | ||
|
||
if(!function_exists('ctype_digit')) { | ||
/** | ||
* Check for numeric character(s) | ||
* | ||
* @see ctype_digit | ||
* @param string $text | ||
* @return bool | ||
*/ | ||
function ctype_digit($text) { | ||
if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars | ||
if(preg_match('/^\d+$/', $text)) return true; | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters