Backward Incompatible Changes

Although most existing PHP 5 code should work without changes, you should pay attention to the following backward incompatible changes:

  • getrusage()returns null when passed incompatible arguments as of php 5.2.1.
  • ziparchive::setcommentname()returns true on success as of php 5.2.1.
  • ziparchive::setcommentindex()returns true on success as of php 5.2.1.
  • splfileobject::getfilename()returns the filename, not relative/path/to/file, as of php 5.2.1.
  • changed priority of phprc environment variable on win32 the phprc environment variable now takes priority over the path stored in the windows registry.
  • cli sapi no longer checks cwd for php.ini or the php-cli.ini file in php 5.1.x an undocumented feature was added that made the cli binary check the current working directory for a php configuration file, potentially leading to unpredictable behavior if an unexpected configuration file were read. this functionality was removed in 5.2.0, and php will no longer search cwd for the presence of php.ini or php-cli.ini files. see also the command line section of the manual.
  • added a warning when performing modulus 0 operations in earlier versions of php, performing integer % 0 did not emit any warning messages, instead returning an unexpected return value of false. as of php 5.2.0, this operation will emit an e_warning, as is the case in all other instances where division by zero is performed. <?phpprint 10 % 0;?>
  • changed __tostring()to be called wherever applicable. the magic method __tostring()will now be called in a string context, that is, anywhere an object is used as a string. the fallback of returning a string that contains the object identifier was dropped in php 5.2.0. it became problematic because an object identifier cannot be considered unique. this change will mean that your application is flawed if you have relied on the object identifier as a return value. an attempt to use that value as a string will now result in a catchable fatal error. <?phpclass foo{}$foo = new foo;print $foo;?> even with __tostring(), objects cannot be used as array indices or keys. we may add built-in hash support for this at a later date, but as of php 5.2.x you will need to either provide your own hashing or use the new spl function spl_object_hash(). exceptions can not be thrown from __tostring()methods. <?phpclass foo{public function __tostring(){throw new exception;}}try{print new foo;}catch(exception $e){}?>
  • dropped abstract static class functions. due to an oversight, php 5.0.x and 5.1.x allowed abstract static functions in classes. as of php 5.2.x, only interfaces can have them. <?phpabstract class foo{abstract static function bar();}?>
  • oracle extension requires at least oracle 10 on windows.
  • added rfc2397(data: stream)support. the introduction of the 'data' url scheme has the potential to lead to a change of behavior under windows. if you are working with a ntfs file system and making use of meta streams in your application, and if you just happen to be using a file with the name 'data:' that is accessed without any path information - it won't work any more. the fix is to use the 'file:' protocol when accessing it. see also » rfc 2397 <?phpinclude "data:;base64,pd9wahagcghwaw5mbygpoz8+";?>
  • regression in glob()patterns in version 5.2.4 a security fix caused a regression for patterns of the form "/foo/*/bar/*". since version 5.2.5 instead of raising a warning the glob()function will return false when openbase_dir restrictions are violated.

淘宝 adsense 商品推荐

官方正版 Google AdSense实战宝典 用谷歌广告联盟出海赚美元 第2版 祁劲松 网站运营书籍 seo搜索引擎优化 AdSense从入门到精通