diff --git a/lib/ctype/ctype.php b/lib/ctype/ctype.php
new file mode 100644
index 00000000..5d15977e
--- /dev/null
+++ b/lib/ctype/ctype.php
@@ -0,0 +1,24 @@
+
\ No newline at end of file
diff --git a/src/phpfreechat.class.php b/src/phpfreechat.class.php
index 30ba2f9a..5f124bd9 100644
--- a/src/phpfreechat.class.php
+++ b/src/phpfreechat.class.php
@@ -381,6 +381,7 @@ function loadStyles($theme = 'default', &$xml_reponse)
$js = '';//file_get_contents(dirname(__FILE__).'/client/createstylerule.js');
$js .= 'var c = $H();';
$path = $c->getFilePathFromTheme('style.css.php');
+ require_once dirname(__FILE__).'/../lib/ctype/ctype.php'; // to keep compatibility for php without ctype support
require_once dirname(__FILE__).'/../lib/csstidy-1.2/class.csstidy.php';
$css = new csstidy();
$css->set_cfg('preserve_css',false);
diff --git a/testcase/ctype.php b/testcase/ctype.php
new file mode 100644
index 00000000..5e4fe767
--- /dev/null
+++ b/testcase/ctype.php
@@ -0,0 +1,47 @@
+";
+foreach ($test as $a)
+{
+ echo $a . " : " . ((my_ctype_space($a)) ? "true" : "false") ." : " . ((ctype_space($a)) ? "true" : "false") ."
";
+}
+
+
+echo "ctype_xdigit()"."
";
+foreach ($test as $a)
+{
+ echo $a . " : " . ((my_ctype_xdigit($a)) ? "true" : "false"). " : " . ((ctype_xdigit($a)) ? "true" : "false") ."
";
+}
+
+echo "ctype_alpha()"."
";
+foreach ($test as $a)
+{
+ echo $a . " : " . ((my_ctype_alpha($a)) ? "true" : "false") ." : " . ((ctype_alpha($a)) ? "true" : "false") ."
";
+}
+
+?>
\ No newline at end of file