--- php/php-src/branches/PHP_5_2/ext/standard/file.c	2009/09/25 01:53:02	288706
+++ php/php-src/branches/PHP_5_2/ext/standard/file.c	2009/09/29 14:14:02	288945
@@ -838,6 +838,10 @@
 	convert_to_string_ex(arg1);
 	convert_to_string_ex(arg2);
 
+	if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(arg1), NULL, CHECKUID_ALLOW_ONLY_DIR))) {
+		RETURN_FALSE;
+	}
+
 	if (php_check_open_basedir(Z_STRVAL_PP(arg1) TSRMLS_CC)) {
 		RETURN_FALSE;
 	}
