From c6e004224997b4de3f454c5f9532d931369e8a19 Mon Sep 17 00:00:00 2001 From: Kalle Sommer Nielsen Date: Sun, 21 Jun 2009 09:42:26 +0000 Subject: [PATCH] Migration guide for 5.3.0 # Feel free to rip it apart and make any changes as needed here git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@282492 c90b9560-bf6c-de11-be94-00142212c4b1 --- appendices/migration5.xml | 7 +- appendices/migration51.xml | 7 +- appendices/migration52.xml | 7 +- appendices/migration53.xml | 1960 ++++++++++++++++++++++++++++++++++++ 4 files changed, 1972 insertions(+), 9 deletions(-) create mode 100644 appendices/migration53.xml diff --git a/appendices/migration5.xml b/appendices/migration5.xml index 00b5154041..7f6a14d095 100755 --- a/appendices/migration5.xml +++ b/appendices/migration5.xml @@ -1,11 +1,12 @@ - + Migrating from PHP 4 to PHP 5.0.x &manual.migration.seealso; - 5.1.x and - 5.2.x. + 5.1.x, + 5.2.x and + 5.2.x.
diff --git a/appendices/migration51.xml b/appendices/migration51.xml index dcd10ed038..d36290af18 100644 --- a/appendices/migration51.xml +++ b/appendices/migration51.xml @@ -1,11 +1,12 @@ - + Migrating from PHP 5.0.x to PHP 5.1.x &manual.migration.seealso; - 5.0.x and - 5.2.x. + 5.0.x, + 5.2.x and + 5.3.x.
diff --git a/appendices/migration52.xml b/appendices/migration52.xml index 4a5d07d9bb..ed356e3dd6 100644 --- a/appendices/migration52.xml +++ b/appendices/migration52.xml @@ -1,11 +1,12 @@ - + Migrating from PHP 5.1.x to PHP 5.2.x &manual.migration.seealso; - 5.0.x and - 5.1.x. + 5.0.x, + 5.1.x and + 5.3.x.
diff --git a/appendices/migration53.xml b/appendices/migration53.xml new file mode 100644 index 0000000000..8a9a13ef0f --- /dev/null +++ b/appendices/migration53.xml @@ -0,0 +1,1960 @@ + + + + Migrating from PHP 5.2.x to PHP 5.3.x + + &manual.migration.seealso; + 5.0.x, + 5.1.x and + 5.2.x. + + +
+ What has changed in PHP 5.3.x + + Most improvements in PHP 5.3.x have no impact on existing code. There are + a few incompatibilities + and new features that should + be considered, and code should be tested before switching PHP + versions in production environments. + + + If the system is being upgraded from PHP 5.1.x, the manual section titled + Upgrade Notes for PHP 5.2.x + should also be read. + + + If the system is being upgraded from PHP 5.0.x, the manual section titled + Upgrade Notes for PHP 5.1.x + should also be read. + + + Similarly, if the system is being upgraded from PHP 4, the manual section + titled Migrating from PHP 4 to PHP 5 + should be read as well. + +
+ +
+ Backward Incompatible Changes + + Although most existing PHP 5 code should work without changes, you should + pay attention to the following backward incompatible changes: + + + + + The internal parameter parsing API have been applied across all + the extensions that PHP 5.3.x comes with. This parameter parsing API + will make the function return &null; if incompatible parameters are + passed to the function. There are some exceptions to this, like the + get_class will still return &false; incase of an + error. + + + + + clearstatcache no longer clears the realpath + cache by default. + + + + + call_user_func and family now propagates $this + even if the callee is the parent class. + + + + + The array functions: natsort, natcasesort, + usort, uasort, uksort, + array_flip and array_unique, no longer accept + objects passed as arguments. If you need to access their properties using an object, + you will need to cast the objects to arrays first. + + + + + The behaviour of functions with by-reference parameters called by value has + changed. Where previously the function would accept the by-value argument, a + warning is now emitted and all by-ref parameters are set to &null;. + + + + + The new mysqlnd library necessitates using MySQL's newer 41 byte password format. + Continued use of the old 16 byte passwords will cause mysql_connect + to produce the following error message: "mysqlnd cannot connect to MySQL 4.1+ + using old authentication". + + + + + The trailing / has been removed from SplFileInfo and other related + directory classes. + + + + + The __toString magic method can + no longer accept arguments. + + + + + The magic methods + __get, + __set, + __isset, + __unset, + __call, + should always be public and can no longer be static. Method signatures are enforced. + + + +
+ +
+ New features + + PHP 5.3.0 contains a wide set of new features, below lists + new features available to the language and syntax. + + + The following keywords are now reserved and may not be used + in function, class etc. names. + + + + + goto + + + + + namespace + + + + + Support for namespaces has been + added. + + + Support for Late Static Bindings + has been added. + + + Support for a jump label (limited goto) has been added. Its only possible to jump + in the same context and out of loops, but not into loops, or other scopes/contexts. + + + + +]]> + + + + PHP now contains support for native closures + (Lambda, Anonymous functions). These are implemented using a new reserved class, + Closure. Closures can be used in any function that takes a + callback as parameter. + + + + +]]> + + + + Theres two new magic methods, + __callStatic and + __invoke. The magic + __invoke method makes it possible for a class instance + to be callable, thrus making it possible to pass it to a parameter of the + callback type. + + + + +]]> + + + + NOWDOC syntax is now + supported, and works like HEREDOC but with single quotes: + + + + +]]> + + + + Static HEREDOCs can be used to initialize static variables, class members + or class constants: + + + + +]]> + + + + Its now possible to declare constants using the const + keyword: + + + + +]]> + + + + The ternary operator + now have a shorthand syntax: + + + + + + +
+ +
+ Changes made to Windows support + + The minimum Windows version is now Windows 2000. (Windows 98, ME and NT4 are + no longer supported). + + + PHP Windows binaries target i586 or later. i386 and i486 are not supported. + + + Windows support has been added for the following functions: + + + + + checkdnsrr + + + + + dns_get_record + + + + + fnmatch + + + + + getmxrr + + + + + getopt + + + + + imagecolorclosesthwb + + + + + inet_ntop + + + + + inet_pton + + + + + link + + + + + linkinfo + + + + + mcrypt_create_iv + + + + + readlink + + + + + socket_create_pair + - This function was previously available on Windows, but + was due to a bug disabled as of PHP 4.3.0. + + + + + stream_socket_pair + + + + + symlink + + + + + time_nanosleep + + + + + time_sleep_until + + + + + Improved portability of stat, touch, + filemtime, filesize and related + functions (100% portable for the available data). + + + Its now possible to use hardlinks on Windows using the link + function, and symbolic links via the symlink function. Hardlinks + are available as of Windows 2000 and symbolic links as of Windows Vista. + + + The Windows version of PHP will expose a set of constants prefixed + PHP_WINDOWS_*, a list of them and their function can be found + here. + + + The PDO_OCI php_pdo_oci8.dll library + (for use with Oracle version 8 client libraries) is no longer being built. Instead, + use php_pdo_oci.dll (note no '8') with Oracle 10 or 11 client + libraries. Connection to other database versions is supported. + + + For the OCI8 extension, a new library + php_oci8_11g.dll is available in addition to php_oci8.dll. + Only one can be enabled at any time. Use php_oci8.dll with Oracle 10.2 + client libraries. Use php_oci8_11g.dll with Oracle 11 client libraries. Connection + to other database versions is supported. + + + Theres now compiler support for Visual C++ 9 (VC9), using Visual Studio 2008. + + + Theres now experimental support for x64 versions of PHP on Windows. + + + + Support for the ISAPI module have been dropped, use the improved + and much better FastCGI sapi module instead. + + + + + A new dedicated site for PHP on Windows, including downloads, release candidates + and snapshots in various flavors (Thread-safe/not-thread-safe, VC6/VC9, x86/x64). + The URL for this site is &url.php.windows;. + + +
+ +
+ Changes in SAPI modules + + FastCGI is now always enabled and can not be disabled. See sapi/cgi/CHANGES + for more details. + + + A new CGI SAPI option, -T, can be used to measure execution time of a script + repeated several times. + + + CGI/FastCGI now has support for .htaccess style user-defined &php.ini; files. + +
+ +
+ Deprecated features in PHP 5.3.x + + PHP 5.3.0 introduces two new error levels; E_DEPRECATED + and E_USER_DEPRECATED. The E_DEPRECATED + error level is used to indicated that a feature have been deprecated, the + E_USER_DEPRECATED level should be used to indicate deprecated + features in userland defined code, just like the E_USER_WARNING + level for example. + + + The following is a list of deprecated INI directives, if one or more of these + are activated, they will issue an deprecation notice upon startup. + + + + + define_syslog_variables + + + + + register_globals + + + + + register_long_arrays + + + + + safe_mode + + + + + magic_quotes_gpc + + + + + magic_quotes_runtime + + + + + magic_quotes_sybase + + + + + Deprecated functions: + + + + + define_syslog_variables + + + + + ereg + + + + + ereg_replace + + + + + eregi + + + + + eregi_replace + + + + + split + + + + + spliti + + + + + sql_regcase + + + +
+ +
+ Undeprecated features in PHP 5.3.x + + The is_a have been undeprecated by + popular request, meaning it will no longer issue an + E_STRICT error. + +
+ +
+ New Parameters + + Some functions were given new, optional, parameters in PHP 5.3.x: + + PHP Core: + + + + clearstatcache + - Added clear_realpath_cache + and filename. + + + + + copy + - Added context. + + + + + fgetcsv + - Added escape. + + + + + ini_get_all + - Added details. + + + + + nl2br + - Added is_xhtml. + + + + + parse_ini_file + - Added scanner_mode. + + + + + round + - Added mode. + + + + + stream_context_create + - Added params. + + + + + strstr and stristr + - Added before_needle. + + + + + json: + + + + json_encode + - Added options. + + + + + + New parameters to methods in PHP 5.3.0. + + PHP Core: + + + + Exception:__construct + - Added previous. + + + +
+ +
+ New Functions + + PHP 5.3.x introduced some new functions: + + + PHP Core: + + + + array_replace + - Replaces elements from passed arrays into one + array. + + + + + array_replace_recursive + - Recursively replaces elements from passed arrays + into one array. + + + + + class_alias + - Creates an alias for a user defined class. + + + + + forward_static_call + - Call a user function which is the first parameter. + + + + + forward_static_call_array + - Call a user function which is the first parameter + with the arguments contained in an array. + + + + + gc_collect_cycles + - Forces collection of any existing garbage cycles. + + + + + gc_disable + - Deactivates the circular reference collector. + + + + + gc_enable + - Activated the circular reference collector. + + + + + gc_enabled + - Returns the status of the circular reference + collector. + + + + + get_called_class + - Gets the name of the class the static method is + called in. + + + + + gethostname + - Gets the standard host name for the local machine. + + + + + header_remove + - Removes an HTTP header previously set using the + header function. + + + + + lcfirst + - Make a string's first character lowercase. + + + + + parse_ini_string + - Parse a configuration string. + + + + + quoted_printable_encode + - Convert an 8 bit string to a quoted-printable + string. + + + + + str_getcsv + - Parse a CSV string into an array. + + + + + stream_context_set_default + - Set the default stream context. + + + + + stream_supports_lock + - Tells whether the stream supports locking. + + + + + Date/Time: + + + + date_add + - Adds an amount of days, months, years, hours, minutes and + seconds to a DateTime object. + + + + + date_create_from_format + - Returns new DateTime object formatted according to the + specified format. + + + + + date_diff + - Returns the difference between two DateTime objects. + + + + + date_get_last_errors + - Returns the warnings and errors from the last + date/time operation. + + + + + date_parse_from_format + - Get info about given date. + + + + + date_sub + - Subtracts an amount of days, months, years, hours, minutes + and seconds from a DateTime object. + + + + + timezone_version_get + - Gets the version of the timezonedb. + + + + + GMP: + + + + gmp_testbit + - Tests if a bit is set. + + + + + Hash: + + + + hash_copy + - Copy hashing context. + + + + + JSON: + + + + json_last_error + - Returns the last json error that occurred. + + + + + MySQL Improved: + + + + mysqli_fetch_all + - Fetches all result rows as an associative array, a numeric + array, or both. + + + + + mysqli_get_connection_stats + - Returns statistics about the client connection. + + + + + mysqli_poll + - Poll connections. + + + + + mysqli_reap_async_query + - Get result from async query. + + + + + OpenSSL: + + + + openssl_random_pseudo_bytes + - Returns a string of the length specified filled with + random pseudo bytes. + + + + + PCNTL: + + + + pcntl_signal_dispatch + - Calls signal handlers for pending signals. + + + + + pcntl_sigprocmask + - Sets and retrieves blocked signals. + + + + + pcntl_sigtimedwait + - Waits for signals, with a timeout. + + + + + pcntl_sigwaitinfo + - Waits for signals. + + + + + PCRE: + + + + preg_filter + - Perform a regular expression search and replace. + + + + + Semaphore: + + + + msg_queue_exists + - Check whether a message queue exists. + + + +
+ +
+ New stream wrappers + + The following stream wrappers were introduced in 5.3.0: + + + + + glob:// + + + + + phar:// + + + +
+ +
+ New Class Constants + + New class constants that were introduced in 5.3.0: + + + PDO_FIREBIRD: + + + + PDO::FB_ATTR_DATE_FORMAT + - Sets the format for dates. + + + + + PDO::FB_ATTR_TIME_FORMAT + - Sets the format for time. + + + + + PDO::FB_ATTR_TIMESTAMP_FORMAT + - Sets the format for timestamps. + + + +
+ +
+ New Methods + + New methods that were introduced in 5.3.0: + + + Date/Time: + + + + DateTime::add + - Adds an amount of days, months, years, hours, minutes and + seconds to a DateTime object. + + + + + DateTime::createFromFormat + - Returns new DateTime object formatted according to the + specified format. + + + + + DateTime::diff + - Returns the difference between two DateTime objects. + + + + + DateTime::getLastErrors + - Returns the warnings and errors from the last + date/time operation. + + + + + DateTime::sub + - Subtracts an amount of days, months, years, hours, minutes + and seconds from a DateTime object. + + + + + PDO_FIREBIRD: + + + + PDO::setAttribute + - Set an attribute. + + + + + Reflection: + + + + ReflectionClass::getNamespaceName() + - Returns the name of namespace where this class is defined. + + + + + ReflectionClass::getShortName() + - Returns the short name of the class (without namespace part). + + + + + ReflectionClass::inNamespace() + - Returns whether this class is defined in a namespace. + + + + + ReflectionFunction::getNamespaceName() + - Returns the name of namespace where this function is defined. + + + + + ReflectionFunction::getShortName() + - Returns the short name of the function (without namespace part). + + + + + ReflectionFunction::inNamespace() + - Returns whether this function is defined in a namespace. + + + + + ReflectionProperty::setAccessible() + - Sets whether non-public properties can be requested. + + + + + XSL: + + + + XSLTProcessor::setProfiling + - Sets the profiling output file. + + + +
+ +
+ Removed Extensions + + These extensions have been moved to PECL and are no longer + part of the PHP distribution. The PECL package version of + these extensions will be created according to user demand. + + + + + dbase + - No longer maintained + + + + + fbsql + - No longer maintained + + + + + fdf + - Maintained + + + + + ming + - Maintained + + + + + msql + - No longer maintained + + + + + ncurses + - Maintained + + + + + sybase + - Discontinued, use sybase_ct + instead, which still is in the PHP Core. + + + +
+ +
+ New Extensions + + The following are new extensions added (by default) as of PHP 5.3.0: + + + + + Fileinfo + - Improved and more solid replacement for the + Mimetype extension. + + + + + INTL + - Internationalization extension. INTL is a wrapper around the + ICU library. + + + + + Phar + - Implementation of PHP-Archive files. + + + + + SQLite3 + - Support for SQLite version 3 databases. + + + +
+ +
+ Other changes to extensions + + The following are new extensions can no longer be disabled + during compilation configure: + + + + + PCRE + + + + + Reflection + + + + + SPL + + + + + Changes in behaviour/new features to extensions: + + + + + Hash + - The SHA-224 hash algorithm is now supported. + + + + + OCI8 + - Calling oci_close on a persistent + connection, or on a variable that references a persistent + connection going out of scope, will now roll back any uncommitted + transaction. You should explicitly commit or rollback as needed. Setting + oci8.old_oci_close_semantics=On + in &php.ini; gives the old behaviour. + + + + + OpenSSL + - There is now support for OpenSSL digest and cipher functions. It is also + now possible to access the internal values of DSA, RSA and DH keys. + + + + + Session + - Sessions will no longer store session-files in "/tmp" + where open_basedir restrictions apply, + unless "/tmp" is explicitly added to the list of allowed paths. + + + + + mysqlnd is a new core library shipped with PHP. It is a PHP-specific + replacement for libmysql. + +
+ +
+ New Classes + + The following classes were introduced in PHP 5.3.0: + + + Date/Time: + + + + DateInterval + + + + + DatePeriod + + + + + Phar: + + + + Phar + + + + + PharData + + + + + PharException + + + + + PharFileInfo + + + + + SPL: + + + + FilesystemIterator + + + + + GlobIterator + + + + + MultipleIterator + + + + + RecursiveTreeIterator + + + + + SplDoublyLinkedList + + + + + SplFixedArray + + + + + SplHeap + + + + + SplMaxHeap + + + + + SplMinHeap + + + + + SplPriorityQueue + + + + + SplQueue + + + + + SplStack + + + +
+ +
+ New Global Constants + + PHP Core: + + + + __DIR__ + + + + + __NAMESPACE__ + + + + + E_DEPRECATED + + + + + E_USER_DEPRECATED + + + + + INI_SCANNER_NORMAL + + + + + INI_SCANNER_RAW + + + + + PHP_WINDOWS_NT_DOMAIN_CONTROLLER + + + + + PHP_WINDOWS_NT_SERVER + + + + + PHP_WINDOWS_NT_WORKSTATION + + + + + PHP_WINDOWS_VERSION_BUILD + + + + + PHP_WINDOWS_VERSION_MAJOR + + + + + PHP_WINDOWS_VERSION_MINOR + + + + + PHP_WINDOWS_VERSION_PLATFORM + + + + + PHP_WINDOWS_VERSION_PRODUCTTYPE + + + + + PHP_WINDOWS_VERSION_SP_MAJOR + + + + + PHP_WINDOWS_VERSION_SP_MINOR + + + + + PHP_WINDOWS_VERSION_SUITEMASK + + + + + GD: + + + + IMG_FILTER_PIXELATE + + + + + JSON: + + + + JSON_ERROR_CTRL_CHAR + + + + + JSON_ERROR_DEPTH + + + + + JSON_ERROR_NONE + + + + + JSON_ERROR_STATE_MISMATCH + + + + + JSON_ERROR_SYNTAX + + + + + LDAP: + + + + LDAP_OPT_NETWORK_TIMEOUT + + + + + PCRE: + + + + PREG_BAD_UTF8_OFFSET_ERROR + + + + + PCNTL: + + + + BUS_ADRALN + + + + + BUS_ADRERR + + + + + BUS_OBJERR + + + + + CLD_CONTIUNED + + + + + CLD_DUMPED + + + + + CLD_EXITED + + + + + CLD_KILLED + + + + + CLD_STOPPED + + + + + CLD_TRAPPED + + + + + FPE_FLTDIV + + + + + FPE_FLTINV + + + + + FPE_FLTOVF + + + + + FPE_FLTRES + + + + + FPE_FLTSUB + + + + + FPE_FLTUND + + + + + FPE_INTDIV + + + + + FPE_INTOVF + + + + + ILL_BADSTK + + + + + ILL_COPROC + + + + + ILL_ILLADR + + + + + ILL_ILLOPC + + + + + ILL_ILLOPN + + + + + ILL_ILLTRP + + + + + ILL_PRVOPC + + + + + ILL_PRVREG + + + + + POLL_ERR + + + + + POLL_HUP + + + + + POLL_IN + + + + + POLL_MSG + + + + + POLL_OUT + + + + + POLL_PRI + + + + + SEGV_ACCERR + + + + + SEGV_MAPERR + + + + + SI_ASYNCIO + + + + + SI_KERNEL + + + + + SI_MESGQ + + + + + SI_NOINFO + + + + + SI_QUEUE + + + + + SI_SIGIO + + + + + SI_TIMER + + + + + SI_TKILL + + + + + SI_USER + + + + + SIG_BLOCK + + + + + SIG_SETMASK + + + + + SIG_UNBLOCK + + + + + TRAP_BRKPT + + + + + TRAP_TRACE + + + +
+ +
+ Changes to INI file handling + + PHP 5.3.0 have significantly improved performance, parsing and + new features syntax features. + + + + + The standard &php.ini; files have been re-organized, and renamed. + php.ini-development have settings thats recommded + for use in a development envoirment. php.ini-production + is configured to production envoirments. + + + + + There is now support for special sections: + [PATH=/opt/httpd/www.example.com/] and + [HOST=www.example.com]. Directives set in these + sections cannot be overridden by user-defined INI files or at + runtime. More information about these sections can be found + here. + + + + + zend_extension_debug and zend_extension_ts + have been removed. Instead use the zend_extension + directive to load all Zend Extensions. + + + + + zend.ze1_compatibility_mode has been removed. If this ini directive is set + to on, then an E_ERROR is emitted at startup. + + + + + It is now possible to use the full path to load modules using the + "extension" directive. + + + + + "ini-variables" can now be used almost anywhere in a php.ini file. + + + + + Runtime tightening of open_basedir restrictions is now possible. + + + + + It is now possible to use alphanumeric or variable indices in ini option + arrays. + + + + + get_cfg_var is now able to return "array" INI options. + + + + + The following new ini directives have been added: + + + + + user_ini.filename and user_ini.cache_ttl + for the new user initialization mechanism. + + + + + Added mbstring.http_output_conv_mimetype. + This directive specifies the regex pattern of content types for which + mb_output_handler is activated. + + + +
+ +
+ Other changes + + SplFileInfo::getpathinfo now returns information about + the path name. + + + SplObjectStorage now has ArrayAccess + support. It is also now possible to store associative information with objects in + SplObjectStorage. + + + In the GD extension, there is now pixelation support available through + the imagefilter function. + + + There is now native support for the following math functions: asinh, + acosh, atanh, log1p and + expm1. + + + var_dump output now includes private object members. + + + session_start now returns FALSE when the session startup fails. + + + Stream wrappers can now be used by + include_path. + + + The directory functions opendir, + scandir and dir now use the default + context if no context is passed as an argument to them. + + + crypt now has Blowfish and extended DES support, and + crypt features are now 100% portable. PHP has its own + internal crypt implementation which drops into place when support for + crypt or crypt_r is not found. + +
+
+ +