Correction on my previous note.
sed -i 's/\$HTTP_\(.*\)_VARS/\$_\1/g' {} \;
will screw up multiple instances of $HTTP_*_VARS in the file.
You'll have to use an instance of sed like:
sed -i 's/\$HTTP_SERVER_VARS/\$_SERVER/g'
i.e.
find ./ -name "*.php" -exec sed -i 's/\$HTTP_POST_VARS/\$_POST/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_GET_VARS/\$_GET/g' {} \;
...
for each of the deprecated variables you might have in your files.
It also occurred to me a simple php conversion script would also work:
$search=array(
"/HTTP_SERVER_VARS/",
"/HTTP_POST_VARS/",
"/HTTP_ENV_VARS/",
"/HTTP_GET_VARS/",
"/HTTP_COOKIE_VARS/",
"/HTTP_SESSION_VARS/",
"/HTTP_POST_FILES/");
$replace=array(
"_SERVER",
"_POST",
"_ENV",
"_GET",
"_COOKIES",
"_SESSION","_FILES");
$content=file_get_contents("somefile.php");
$content=preg_replace($search,$replace,$content);
file_put_contents("somefile.php",$content);
add directory recursion functions, ect.
PHP 5.3.x 中弃用的功能
PHP 5.3.0 新增了两个错误等级: E_DEPRECATED
和 E_USER_DEPRECATED. 错误等级 E_DEPRECATED 被用来说明一个函数或者功能已经被弃用. E_USER_DEPRECATED 等级目的在于表明用户代码中的弃用功能, 类似于
E_USER_ERROR 和 E_USER_WARNING 等级.
下面是被弃用的 INI 指令列表. 使用下面任何指令都将导致 E_DEPRECATED 错误.
- define_syslog_variables
- register_globals
- register_long_arrays
- safe_mode
- magic_quotes_gpc
- magic_quotes_runtime
- magic_quotes_sybase
- 弃用 INI 文件中以 '#' 开头的注释.
弃用函数:
- call_user_method() (使用 call_user_func() 替代)
- call_user_method_array() (使用 call_user_func_array() 替代)
- define_syslog_variables()
- dl()
- ereg() (使用 preg_match() 替代)
- ereg_replace() (使用 preg_replace() 替代)
- eregi() (使用 preg_match() 配合 'i' 修正符替代)
- eregi_replace() (使用 preg_replace() 配合 'i' 修正符替代)
- set_magic_quotes_runtime() 以及它的别名函数 magic_quotes_runtime()
- session_register() (使用 $_SESSION 超全部变量替代)
- session_unregister() (使用 $_SESSION 超全部变量替代)
- session_is_registered() (使用 $_SESSION 超全部变量替代)
- set_socket_blocking() (使用 stream_set_blocking() 替代)
- split() (使用 preg_split() 替代)
- spliti() (使用 preg_split() 配合 'i' 修正符替代)
- sql_regcase()
- mysql_db_query() (使用 mysql_select_db() 和 mysql_query() 替代)
- mysql_escape_string() (使用 mysql_real_escape_string() 替代)
- 废弃以字符串传递区域设置名称. 使用 LC_* 系列常量替代.
-
mktime() 的
is_dst参数. 使用新的时区处理函数替代.
弃用的功能:
- 弃用通过引用分配 new 的返回值.
- 调用时传递引用被弃用.
shad at shartley dot net
23-Sep-2010 03:20
shad at shartley dot net
11-Sep-2010 04:37
If you previously defined register_long_arrays in php.ini and have a lot of code with $HTTP_*_VARS that need to be replaced the following may help on *.nix systems:
sed -i 's/\$HTTP_\(.*\)_VARS/\$_\1/g' filename.php
What this command does is replace all occurrences of $HTTP_*_VARS with their respective $_ counter parts, e.g. $HTTP_COOKIES_VAR to $_COOKIES
To replace alot of files, you might combine it with the find command:
find ./ -name "*.php" -exec sed -i 's/\$HTTP_\(.*\)_VARS/\$_\1/g' {} \;
For other deprecated variables like $HTTP_POST_FILES change your sed arguments:
sed -i 's/\$HTTP_POST_FILES/\$_FILES/g'
Deprecated variables created by the register_long_arrays directive as far as I know are:
$_POST
$_GET
$_SERVER
$_ENV
$_COOKIE
$_SESSION
Anonymous
26-Mar-2010 05:02
A backward compatibility break which is not documented:
Fatal error: Uncaught exception 'RuntimeException' with message 'Directory name must not be empty.'
This happens with new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $staticPath ) )
