doc:scratchpad:upgrade:53
This is an old revision of the document!
PHP 5.3 upgrading notes
- This document is work in progress, and eventually will live in the PHP Manual
- Add all information, changed behaviour or new features, much like http://php.net/migration52 is for 5.2.0
- See also undocumented
Changes to the syntax which might break existing applications
- namespace is now a reserved word. Applications can't use namespace as identifier anymore. Doing so will create a Fatal Error while parsing the script.
- goto is now a reserved keyword. Applications can't use goto as identifier anymore. Doing so will create a Fatal Error while parsing the script.
- Closure is now a reserved class. (Used by lambda and closure)
Changes to functions affecting backwards compatibility
- The functions natsort, natcasesort, usort, uasort, uksort, array_flip, array_unique don't take objects anymore as parameters. For accessing their properties using this way you have to cast the objects to arrays first.
- var_dump() output with objects (some internal classes emit internal states as private properties that are not accessible otherwise, for Example SimpleXML exposes its virtual properties)
- session_start() now returns false if session startup fails for some reason.
- clearstatcache() now defaults to not clear the realpath cache.
- opendir(), scandir() and dir() now use the default context if no context passed.
- If a function with by-reference parameters is called by value ( for example with call_user_func_array) a warning message is produced and all by-reference parameters are set to NULL. In older versions, the function was called with by value parameters.
- call_user_func now propagates $this even if the callee is the parent class (cf #47402)
- 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.”
Changes to method signatures affecting backwards compatibility
- __get, __set, __isset, __unset, __call magic methods should be public now and can not be static, argument signatures enforced
- __toString magic method can not accept parameters
- __callStatic is a new magic method
- count() vs count_elements handler resolution rules change (might break custom PHP exts not in PECL/php-src)
- __invoke ('class fail { function __invoke() { echo "hello world\n"; } } $o = new fail; $o();' // hello world)
Changes to binary releases for Windows
- The minimum Windows versions are now windows 2000/XP (windows 98 or NT4 are not supported anymore)
- Binaries target 586 or later, i386, i486 are not supported (was already the case before but not mentioned in the manual)
Libraries added
- mysqlnd (optional replacement for libmysql)
Extensions added
Extensions removed
Moved to PECL and maintained there
- ncurses (maintained)
- fpdf (maintained)
- dbase
- fbsql
- ming
- msql
Not maintained and superseded
- sybase (please use sybase_ct which is maintained and still in core)
Extension Changes Causing Incompatibilities
OCI8
- Oci_close() on a persistent connection, or all variables referencing a persistent connection going out of scope, now rolls back any uncommitted transaction. Make sure you explicitly commit or rollback as needed. Alternatively, setting oci8.old_oci_close_semantics to On gives the old behavior where oci_close() is a no-op for all types of connection.
Session
- Sessions would no longer succeed to store session-files in “/tmp” path if open_basedir restriction is enabled, and “/tmp” is not explicitly added to allowed paths list (special treatment of “/tmp” was added in 5.2.2, but was not documented)
Deprecated
- Ticks (declare(ticks=N) and register_tick_function() now issues
E_DEPRECATED
) - define_syslog_variables() now issues
E_DEPRECATED
- all ereg functions now issues
E_DEPRECATED
(note that not all of them are prefixed with ereg)
Undeprecated
Changes to .INI settings
- Removed zend.ze1_compatibility_mode.
- user_ini.filename user-initialization mechanism and config variables: user_ini.filename and user_ini.cache_ttl.
- Added support for special [PATH=/opt/httpd/www.example.com/] and [HOST=www.example.com] sections. Directives set in these sections can not be overridden by user-defined ini-files or during runtime.
- Added mbstring.http_output_conv_mimetype that specifies the regex pattern of content types for which mb_output_handler() is activated.
- Allowed using full path to load modules using “extension” directive.
- Allowed “ini-variables” to be used almost everywhere ini php.ini files.
- Allowed using alphanumeric/variable indexes in “array” ini options.
- Allowed run-time tightening of open_basedir (http://docs.php.net/manual/en/ini.sect.safe-mode.php#ini.open-basedir)
No longer allow to disable
- PCRE
- Reflection
- SPL
New parameters
Filesystem
- fgetcsv(): Added
escape
. - copy(): Added
context
. - parse_ini_file(): Added
scanner_mode
.
Info
- ini_get_all(): Added
details
.
Math
- round(): Added
mode
.
Streams
- stream_context_create(): Added
params
.
Strings
- nl2br(): Added
is_xhtml
.
Exceptions
- Exception::__construct(): Added
previous
.
New functions
Array
- array_replace()
- array_replace_recursive()
Date
- date_diff()
- date_parse_from_format()
- date_create_from_format()
- date_get_last_errors()
Filesystem
- Now with Windows support:
GMP
Hash
JSON
Image
- Now with Windows support:
Math
- Now with native support:
Misc
- Now with Windows support:
MySQLi
- mysqli_fetch_all()
- mysqli_get_connection_stats()
- mysqli_poll()
- mysqli_reap_async_query()
Mcrypt
- Now with Windows support:
Network
- Now with Windows support:
OpenSSL
- openssl_random_pseudo_bytes()
PCNTL
PCRE
- preg_filter()
PHP Core
- Now with Windows support:
- getopt()
- gc_collect_cycles()
- gc_enabled()
- gc_enable()
- gc_disable()
- class_alias()
- get_extension_funcs()
- forward_static_call()
- forward_static_call_array()
- quoted_printable_encode()
SHM
Sockets
- Now with Windows support (again):
- socket_create_pair()
SPL
- trailing / removed from SplFileInfo and other related directory classes
- SplFileInfo::getpathinfo() returns info on the pathname
Streams
- Now with Windows support:
Strings
New methods
Date
PDO/Firebird
Reflection
XSL
New classes
Date
- DateInterval
- DatePeriod
Phar
SPL
- SplFixedArray
- FilesystemIterator
- GlobIterator
- RecursiveTreeIterator
- MultipleIterator
New global constants
Filesystem
- INI_SCANNER_NORMAL
- INI_SCANNER_RAW
GD
- IMG_FILTER_PIXELATE
JSON
- JSON_ERROR_NONE
- JSON_ERROR_DEPTH
- JSON_ERROR_STATE_MISMATCH
- JSON_ERROR_CTRL_CHAR
- JSON_ERROR_SYNTAX
LDAP
- LDAP_OPT_NETWORK_TIMEOUT
PCRE
PHP Core
PCNTL
- “how” argument in pcntl_sigprocmask()
- SIG_BLOCK
- SIG_UNBLOCK
- SIG_SETMASK
- Value of “code” in the argument “info” set by reference by pcntl_sigwaitinfo() and pcntl_sigtimedwait()
- SI_USER
- SI_NOINFO
- SI_KERNEL
- SI_QUEUE
- SI_TIMER
- SI_MESGQ
- SI_ASYNCIO
- SI_SIGIO
- SI_TKILL
- CLD_EXITED
- CLD_KILLED
- CLD_DUMPED
- CLD_TRAPPED
- CLD_STOPPED
- CLD_CONTINUED
- TRAP_BRKPT
- TRAP_TRACE
- POLL_IN
- POLL_OUT
- POLL_MSG
- POLL_ERR
- POLL_PRI
- POLL_HUP
- ILL_ILLOPC
- ILL_ILLOPN
- ILL_ILLADR
- ILL_ILLTRP
- ILL_PRVOPC
- ILL_PRVREG
- ILL_COPROC
- ILL_BADSTK
- FPE_INTDIV
- FPE_INTOVF
- FPE_FLTDIV
- FPE_FLTOVF
- FPE_FLTUND
- FPE_FLTRES
- FPE_FLTINV
- FPE_FLTSUB
- SEGV_MAPERR
- SEGV_ACCERR
- BUS_ADRALN
- BUS_ADRERR
- BUS_OBJERR
New class constants
PDO/Firebird
- PDO::FB_ATTR_DATE_FORMAT
- PDO::FB_ATTR_TIME_FORMAT
- PDO::FB_ATTR_TIMESTAMP_FORMAT
New stream wrappers
Phar
- Phar stream wrapper for accessing phar archives
Streams
- Added “glob” stream wrapper
Other informations
GD
- Added pixelation support through imagefilter()
Hash
- Added sha224 hash algorithm to the hash extension.
OpenSSL
- Added support for OpenSSL digest and cipher functions.
- Added access to internal values of DSA, RSA and DH keys.
PHP Core
- crypt()
- Added Blowfish and extended DES support.
- Made crypt features 100% portable.
- MD5 crypt, standard DES, extended DES as well as the new Blowfish algorithms are not always available. PHP contains its own implementation and will use it as soon as libc's libcrypt is lacking any of them or the crypt_r function
- Fixed get_cfg_var() to be able to return “array” ini options.
SAPI
- FastCGI is now always enabled and can not be disabled. (See sapi/cgi/CHANGES for more details)
- Added CGI SAPI -T option which can be used to measure execution time of script repeated several times.
- Added “.htaccess” style user-defined php.ini files support for CGI/FastCGI.
SPL
- Added ArrayAccess support to SplObjectStorage.
- Added ability to store associative information with objects in SplObjectStorage.
Streams
- Added ability to use stream wrappers in include_path.
Windows Support
- Improve portability of stat, touch, filemtime, filesize and related functions (100% portable for the available data)
New syntactic sugar
<<<'LABEL' ...
HEREDOC with double quotes
<<<"LABEL" ...
Static HEREDOCs can now be used to initialize static variables and class members or constants (like NOWDOC)
static $foo = <<<LABEL No variables here... LABEL;
?: operator
- var_dump(0 ?: 'Hello!'); string(6) “Hello!”
doc/scratchpad/upgrade/53.1237722763.txt.gz · Last modified: 2017/09/22 13:28 (external edit)