Wednesday, March 24, 2010

Deprecated functions in php 5.3.x

• call_user_method() (use call_user_func() instead)
• call_user_method_array() (use call_user_func_array() instead)
• define_syslog_variables()
• dl()
• ereg() (use preg_match() instead)
• ereg_replace() (use preg_replace() instead)
• eregi() (use preg_match() with the 'i' modifier instead)
• eregi_replace() (use preg_replace() with the 'i' modifier instead)
• set_magic_quotes_runtime() and its alias, magic_quotes_runtime()
• session_register() (use the $_SESSION superglobal instead)
• session_unregister() (use the $_SESSION superglobal instead)
• session_is_registered() (use the $_SESSION superglobal instead)
• set_socket_blocking() (use stream_set_blocking() instead)
• split() (use preg_split() instead)
• spliti() (use preg_split() with the 'i' modifier instead)
• sql_regcase()
• mysql_db_query() (use mysql_select_db() and mysql_query() instead)
• mysql_escape_string() (use mysql_real_escape_string() instead)
• Passing locale category names as strings is now deprecated. Use the LC_* family of constants instead.
• The is_dst parameter to mktime(). Use the new timezone handling functions instead.

Tuesday, March 2, 2010

How can I turn off MySQL strict mode? or Solving Incorrect integer value problem with MySQL 5 strict-mode

To turn off strict_mode in MySQL

This can be done in two ways...

Open your "my.ini" file within the MySQL installation directory, and look for the text "sql-mode".

Find:
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Replace with:

# Set the SQL mode to strict
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Or, you can run an SQL query within your database management tool, such as phpMyAdmin:

SET @global.sql_mode= '';

Wednesday, February 17, 2010

Function set_magic_quotes_runtime() is deprecated in PHP 5.3.0

It's better to change the error_reporting line because there are a few other deprecated functions.

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

You need to wrap this in a test for PHP version 5.3 because E_DEPRECATED only became available as of 5.3.


Another method is

find:
set_magic_quotes_runtime(0);
and replace:
ini_set("magic_quotes_runtime", 0);