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.
Funcionalidades obsoletas en PHP 5.3.x
PHP 5.3.0 introduce dos nuevos niveles de error: E_DEPRECATED
y E_USER_DEPRECATED. El nivel de error
E_DEPRECATED se usa para indicar que una función
o funcionalidad está obsoleto. El nivel de error
E_USER_DEPRECATED tiene por objetivo indicar las funcionalidades
obsoletas en el código de usuario, de forma similar a los niveles de error
E_USER_ERROR y E_USER_WARNING.
La siguiente es una lista de directivas INI obsoletas. El uso de cualquiera de
estas directivas INI provocará un error E_DEPRECATED al arrancar.
- define_syslog_variables
- register_globals
- register_long_arrays
- safe_mode
- magic_quotes_gpc
- magic_quotes_runtime
- magic_quotes_sybase
- Ahora están obsoletos los comentarios en ficheros .INI que comienzan con '#'.
Funciones obsoletas:
- call_user_method() (utilice en su lugar call_user_func())
- call_user_method_array() (utilice en su lugar call_user_func_array())
- define_syslog_variables()
- dl()
- ereg() (utilice en su lugar preg_match())
- ereg_replace() (utilice en su lugar preg_replace())
- eregi() (utilice en su lugar preg_match() con el modificador 'i')
- eregi_replace() (utilice en su lugar preg_replace() con el modificador 'i')
- set_magic_quotes_runtime() y su alias, magic_quotes_runtime()
- session_register() (utilice en su lugar la superglobal $_SESSION)
- session_unregister() (utilice en su lugar la superglobal $_SESSION)
- session_is_registered() (utilice en su lugar la superglobal $_SESSION)
- set_socket_blocking() (utilice en su lugar stream_set_blocking())
- split() (utilice en su lugar preg_split())
- spliti() (utilice en su lugar preg_split() con el modificador 'i')
- sql_regcase()
- mysql_db_query() (utilice en su lugar mysql_select_db() y mysql_query())
- mysql_escape_string() (utilice en su lugar mysql_real_escape_string())
- Ahora está obsoleto pasar nombres de categoría local como strings. Utilice la familia de constantes LC_* en su lugar.
-
El parámetro
is_dstpara mktime(). Utilice en su lugar las funciones de manejo de zonas horarias.
Funcionalidades obsoletas:
- Ahora está obsoleto asignar el valor devuelto por new por referencia.
- Ha quedado obsoleto el paso por referencia en tiempo de llamada.
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 ) )
