- 論壇徽章:
- 0
|
see:http://wiki.php.net//doc/scratchpad/upgrade/53
translator:Daniel Qin
My english is not good ,if u discover some errors of translations ,please tell me! and I will correct it.
可能導(dǎo)致當(dāng)前應(yīng)用崩潰的語法變更:
- namespace 當(dāng)前是保留字. 任何程序不能使用 namespace 標(biāo)識(shí)符. 如果用了,在解析PHP腳本的時(shí)候,會(huì)引起致命錯(cuò)誤
- goto 是保留字 任何程序不能使用 namespace 標(biāo)識(shí)符. 如果用了,在解析PHP腳本的時(shí)候,會(huì)引起致命錯(cuò)誤
- Closure 保留類. (Used by lambda and closure)
影響向后兼容的函數(shù)變更
- 函數(shù) next()/current/… 今后不允許帶任何objects參數(shù). 如果要用這種方法訪問類屬性,首先要把objects轉(zhuǎn)換成array
- var_dump() 可以打印 (輸出)objects (一些內(nèi)部類可能會(huì)把它們的內(nèi)部狀態(tài)以私有屬性的方式顯示出來,但是其它情況不會(huì)顯示這些內(nèi)部狀態(tài), 比如 SimpleXML 就暴露出它的虛擬屬性)
影響向后兼容的方法關(guān)鍵詞(method signatures/Visibility)變更
- __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)
Windows 二進(jìn)制發(fā)行版變更
- 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)
crypt() is now 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 libmcrypt is lacking any of them or the crypt_r function
移除的擴(kuò)展
移動(dòng)到 PECL 并由這里維護(hù)
- ncurses (maintained)
- fpdf (maintained)
- sybase (will not be maintained, sybase_ct must be used instead)
不再維護(hù)并且作廢的
- sybase (please use sybase_ct which is maintained and still in core)
引起不兼容的擴(kuò)展變更
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.
棄用
不再棄用
- is_a() (this page says ”[…] but is_a() has since been deprecated in favor of instanceof.”)
.INI 配置變更
- Removed zend.ze1_compatibility_mode.
- user_ini.filename user-initialization mechanism and config variables: user_ini.filename and user_ini.cache_ttl.
- [HOST=] and [PATH=] configuration sections in php.ini
- Added mbstring.http_output_conv_mimetype that specifies the regex pattern of content types for which mb_output_handler() is activated.
不再禁止使用
新參數(shù)
Filesystem
- fgetcsv(): Added escape.
- copy(): Added context.
- parse_ini_file(): Added scanner_mode.
Info
Streams
Strings
新函數(shù)
Date
- date_add()
- date_sub()
- date_diff()
- date_parse_from_format()
- date_create_from_format()
- date_get_last_errors()
GMP
Hash
Image
- Now with Windows support:
Math
Mcrypt
- Now with Windows support:
Network
- Now with Windows support:
SHM
SPL
- trailing / removed from SplFileInfo and other related directory classes
- SplFileInfo::getpathinfo() returns info on the pathname
Streams
Strings
PHP Core
- Now with Windows support:
- gc_collect_cycles()
- gc_enabled()
- gc_enable()
- gc_disable()
- class_alias()
- get_called_class()
- get_extension_funcs()
- forward_static_call()
- forward_static_call_array()
PCNTL
- pcntl_signal_dispatch()
- pcntl_sigprocmask()
- pcntl_sigwaitinfo()
- pcntl_sigtimedwait()
新方法
Date
- DateTime::diff()
- DateTime::add()
- DateTime::sub()
- DateTime::createFromFormat()
- DateTime::getLastErrors()
PDO/Firebird
Reflection
- ReflectionProperty::setAccessible()
XSL
- XSLTProcessor::setProfiling()
新的類
Date
Phar
SPL
新的全局常量
Filesystem
- INI_SCANNER_NORMAL
- INI_SCANNER_RAW
LDAP
PCRE
PHP Core
- E_DEPRECATED
- E_USER_DEPRECATED
- __DIR__
- __NAMESPACE__
- PHP_MAJOR_VERSION
- PHP_MINOR_VERSION
- PHP_RELEASE_VERSION
- PHP_EXTRA_VERSION
- PHP_VERSION_ID
- PHP_ZTS
- PHP_DEBUG
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
新的class 常量
PDO/Firebird
- PDO::FB_ATTR_DATE_FORMAT
- PDO::FB_ATTR_TIME_FORMAT
- PDO::FB_ATTR_TIMESTAMP_FORMAT
新 stream wrappers
Phar
- Phar stream wrapper for accessing phar archives
Streams
- Added “glob” stream wrapper
新語法
NOWDOC
HEREDOC with double quotes
?: operator
|
|