Some php.net moron finally deprecated functions in PHP 5.3.0+

and it's not only session_register()...

1. Problem

following crashes like :
Application défaillante httpd.exe, version 2.2.13.0, module défaillant php5ts.dll, version 5.2.9.9, adresse de défaillance 0x0000a006.
I tried to upgrade from PHP 5.2.9.9 to a newer version.
from 5.2.11.11 (09/04/2009)
trying to go to :
PHP 5.2.17
06-Jan-2011
now shown as "(Old stable) This version is no longer supported by PHP.net"

-> so move to 5.3.latest, namely :
Version 5.3.6
17-Mar-2011
whose changelog contains no deprecations
+
Version 5.3.5
06-Jan-2011
whose changelog seems inocuous to me

result : Apache/2.2.19 (Win32) PHP/5.3.6

Results : no better :
05/05/2011 : Application défaillante httpd.exe, version 2.2.17.0, module défaillant php5ts.dll, version 5.3.6.0, adresse de défaillance 0x0000caf5.
Application défaillante httpd.exe, version 2.2.17.0, module défaillant msvcr90.dll, version 9.0.21022.8, adresse de défaillance 0x0003ab5a.
Application défaillante httpd.exe, version 2.2.17.0, module défaillant php5ts.dll, version 5.2.11.11, adresse de défaillance 0x0009d80f.
17/04/2011 : Application défaillante httpd.exe, version 2.2.13.0, module défaillant php5ts.dll, version 5.2.9.9, adresse de défaillance 0x00009fc3.

But, now that I've upgraded to 5.3, I suddenly discovered a lot of undocumented deprecations. They're NOT in the changelogs !!!

The documented deprecations are :
Version 5.3.0
30-Jun-2009
Deprecated session_register(), session_unregister() and session_is_registered(). (Hannes)
Deprecated define_syslog_variables(). (Kalle)
Deprecated ereg extension. (Felipe)

The undocumented ones include :
PHP Deprecated: Call-time pass-by-reference has been deprecated
PHP Deprecated: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0 (php.ini)
PHP Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0 (php.ini)
the function split() (!!!)
PHP Deprecated: Function ereg_replace() !!!!
PHP Deprecated: Function set_magic_quotes_runtime() is deprecated
force_magic_quote_runtime() !
date(), time() problems :
PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '2.0/DST'
PHP Warning: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '2.0/DST'
PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '2.0/DST' instead

unsure : failed to open stream: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? in

And even cooler, a forced change in MySql support !
PHP Warning: mysql_connect() [function.mysql-connect]: Premature end of data (mysqlnd_wireprotocol.c:554)
PHP Warning: mysql_connect() [function.mysql-connect]: OK packet 1 bytes shorter than expected
PHP Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file

2. About it

About the MySql problem

5. Libmysql and mysqlnd: As of PHP 5.3, libmysql.dll disappeared from the PHP package! PHP 5.3 includes a built-in replacement called mysqlnd. Contrary to earlier suggestions on the MySQL site, there is no mysqlnd download : it's built into PHP 5.3. Now the mysqlnd page (http://dev.mysql.com/downloads/connector/php-mysqlnd/) says "as of PHP 5.3 you can use ext/mysql, ext/mysqli and PDO_MYSQL either together with libmysql as you did in the past or with mysqlnd. We have no plans to remove libmysql support from ext/mysql, ext/mysqli or PDO_MYSQL." Plans or not, they've done it libmysqldll does not exist for PHP 5.3, and earlier libmysql.dlls do not work with with PHP 5.3. But mysqlnd is not entirely reliable in some contexts, and cannot connect to MySQL 4.1 or later servers using the older authentication protocol. If you don't want to live with mysqlnd problems or work around them, naturally you'll want to disable mysqlnd and use libmysql.dll. You can't unless you're willing to recompile PHP from source with a --disable-mysqlnd flag! So if mysqlnd problems affect you, until they're fixed we suggest you use PHP 5.2 instead of PHP 5.3. 6. API libraries: there are two main PHP APIs for MySQL, mysql and mysqli, where i means "improved". The main mysqli improvements are support for O-O syntax and multiple stored procedure calls. But those features come at a price: mysqli syntax is very different, so refactoring code for mysqli can be painful, and the mysqli interface is pickier, so for example determining whether a column is a key requires bit twiddling. Because of all these variations and inconsistencies, before installing any version of PHP you should remove all traces of previous PHP installations, including all PHP-related files in %windir% and %windir%\system32.

Deprecated session_register(), session_unregister() and session_is_registered(). : use $_SESSION[]
Deprecated define_syslog_variables(). : solution?
Deprecated ereg extension. : sh**t
PHP Deprecated: Call-time pass-by-reference has been deprecated : solution?
PHP Deprecated: Directive 'register_globals' is deprecated : comment the line in php.ini
PHP Deprecated: Directive 'magic_quotes_gpc' is deprecated : comment the line.
the function split() : use preg_split() or explode() (this will teach me a lesson : do not use perl programming style)
PHP Deprecated: Function ereg_replace() :
PHP Deprecated: Function set_magic_quotes_runtime() is deprecated : use ini_set() (what a gain in programming style!)
force_magic_quote_runtime() : Use ini_set() as in ini_set('magic_quotes_runtime', 0); // was : set_magic_quotes_runtime(0);
date/timezone problems : add date.timezone="Europe/Paris" in php.ini ; AFAIK, ISO 8601 is not superceded but...


About "PHP Deprecated: Call-time pass-by-reference has been deprecated in" :

  //vgr01022004 added debug parameter
  function setbind( $bindname, $bindvar, $bindsize = 0, $bindtype = false, $debug=false ){
    global $php_self, $script_name;
      if ($this->isprepared) {
        $bindvar = $this->resolvevar($bindvar,$debug);
        if ($debug) echo "db_oci8.setbind('$bindname'->'$bindvar'<br>";
        //if( $this->debug ){
        $this->binds4debug[ $bindname ] = $bindvar;
        //}
-->        if ($bindtype) ocibindbyname( $this->query_id, $bindname, -->&$bindvar<--, $bindsize, $bindtype );
        else {
          if ($bindsize) {
            if (!ocibindbyname( $this->query_id, $bindname, &$bindvar, $bindsize )) {
              //vgr18072003 fixed (quickfix) this ($bindvalue doesn't exist...)
              $theval=htmlspecialchars($bindvar);
              if (seamus()) echo "<br><b>binding error: </b> from script '$script_name' ('$php_self') name: $bindname, value: '$theval'<br>";
            }
          } else {
            if (!ocibindbyname( $this->query_id, $bindname, &$bindvar )) {
              //vgr18072003 fixed (quickfix) this ($bindvalue doesn't exist...)
              $theval=htmlspecialchars($bindvar);
              if (seamus()) echo "<br><b>binding error: </b> from script '$script_name' ('$php_self') name: $bindname, value: '$theval'<br>";
            }
          }
        }
      } else $this->halt( "first call db->preparequery()" );
  }

Forcing you to change old working code running nicely since 2003... for no gain.

9. Conclusion

Of course, most of those problems just require you to upgrade your code. The MySql problem is a little more tricky.
The disappearance of ereg_replace() and split() is really a shame.

I hope my experience will save you some time
Best regards,
Vincent Graux (VGR) for European Experts Exchange and Edaìn Works  back to list of test scripts
Last update 2020-10-17 13:18:46