UPGRADING 22.8 KB
Newer Older
1
$Id: UPGRADING 321040 2011-12-15 10:31:02Z dmitry $
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

UPGRADE NOTES - PHP 5.3

1. Reserved words and classes
2. Changes made to existing functions
3. Changes made to existing methods
4. Changes made to existing classes
5. Deprecated
6. Undeprecated
7. Extensions:
     a. moved out to PECL and actively maintained there
     b. no longer maintained
     c. with changed behaviour
     d. no longer possible to disable
8. Changes in SAPI support
9. Changes in INI directives
10. Syntax additions
11. Windows support
12. New in PHP 5.3:
     a. New libraries
     b. New extensions
     c. New stream wrappers
24 25 26 27 28 29
     d. New stream filters
     e. New functions
     f. New global constants
     g. New classes
     h. New methods
     i. New class constants
30

31 32 33
=============================
1. Reserved words and classes
=============================
34

35
- **namespace** and **goto** are now reserved keywords.
36

37
- **Closure** is now a reserved class. (Used by lambda and closure.)
38

39 40 41
=====================================
2. Changes made to existing functions
=====================================
42

43 44 45
- Paths containing NULL (like /some/path\0foo.txt) are now considered invalid. 
  See http://news.php.net/php.internals/50191

46 47 48
- The HTTP stream wrapper now considers all status codes from 200 to 399 to be
  successful.

49
- The array functions natsort(), natcasesort(), usort(), uasort(), uksort(),
50 51 52
  array_flip(), and array_unique() no longer accept objects passed as arguments.
  If you need to use them to access an object's properties, you must cast the
  object to an array first.
53

54
- var_dump() output now includes private object members.
55

56
- session_start() now returns FALSE when the session startup fails.
57

58 59 60 61 62
- property_exists() now checks the existence of a property independent of
  accessibility (like method_exists()).

- The $initial parameter for array_reduce can now be of any type.

63
- clearstatcache() no longer clears the realpath cache by default.
64

65 66 67
- realpath() is no longer system-dependent and works identically on all
  platforms.

68 69
- call_user_func() now propagates $this even if the callee is the parent class.

70 71
- The filesystem functions opendir(), scandir(), and dir() now use the default
  context if no context argument is passed.
72

73 74 75
- 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.
76

77 78
- There is now native support for the following math functions: asinh(),
  acosh(), atanh(), log1p(), and expm1().
79

80 81
- In the GD extension, there is now pixelation support available through
  the imagefilter() function.
82

83 84 85
- 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 system support for crypt or crypt_r() is not found.
86

87
- get_cfg_var() is now able to return "array" INI options.
88

89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
- Stream wrappers can now be used by the include_path INI directive.

- These functions now take new parameters:
     clearstatcache(): $clear_realpath_cache and $filename.
     copy(): $context
     fgetcsv(): $escape
     ini_get_all(): $details
     json_encode(): $options
     json_decode(): $depth
     nl2br(): $is_xhtml
     parse_ini_file(): $scanner_mode
     round(): $mode
     stream_context_create(): $params
     strstr(), stristr(): $before_needle
     sybase_connect(): $new

- And new mode option for fopen: 'n' (O_NONBLOCK)

- 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()
  and other related functions to produce the following error message:
  "mysqlnd cannot connect to MySQL 4.1+ using old authentication"

- The dl() function is now disabled by default, and only available under the
  cli, cgi, and embed SAPIs.

- mail() now supports the logging of sent mail.

- stream_select(), stream_set_blocking(), stream_set_timeout(), and 
  stream_set_write_buffer() now work with user-space stream wrappers.

- getopt() accepts "long options" now on all platforms.
  Optional values and using = as a separator for short options are now
  supported.
123

124

125 126 127
===================================
3. Changes made to existing methods
===================================
128

129
- The magic methods __get(), __set(), __isset(), __unset(), and __call() should
130
  always be public and can no longer be static. Method signatures are enforced.
131

132 133 134
- The __call() magic method is now invoked on access to private and protected
  methods.

135
- The __toString() magic method can no longer accept arguments.
136

137
- There is a new magic method, __callStatic().
138

139 140
- Internal count() vs. count_elements() handler resolution rules have changed.
  (This could potentially break custom PHP extensions.)
141

142 143
- The trailing / has been removed from SplFileInfo and other related directory
  classes.
144

145
- SplFileInfo::getpathinfo() now returns information about the path name.
146

147
- There are new parameters in:
148
     Exception::__construct(): $previous
149

150 151 152
===================================
4. Changes made to existing classes
===================================
153

154 155
- SplObjectStorage now has ArrayAccess support. It is also now possible to
  store associative information with objects in SplObjectStorage.
156 157 158 159 160 161 162 163 164 165 166 167 168 169
  
=====================
4.1 New in PHP 5.3.9
=====================

- Write operations within XSLT (for example with the extension sax:output) are
  disabled by default. You can define what is forbidden with the INI option
  xsl.security_prefs. This option will be marked as deprecated in 5.4 again. 
  Use the method XsltProcess::setSecurityPrefs($options) there.

- the following new directives were added

  - max_input_vars - specifies how many GET/POST/COOKIE input variables may be
    accepted. default value 1000. 
170 171

=============
172
5. Deprecated
173 174
=============

175
- define_syslog_variables() is deprecated.
176

177 178 179 180 181 182
- set_socket_blocking() is deprecated.

- call_user_method() and call_user_method_array() are now deprecated. Use
  call_user_func() and call_user_func_array() instead.

- dl() is deprecated.
183

184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
- The set_magic_quotes_runtime() function is now deprecated.

- mysql_listtables(), mysql_dropdb(), mysql_createdb(), mysql_list_tables(),
  mysql_drop_db(), and mysql_create_db() are now deprecated.

- All ereg functions are now deprecated and emit E_DEPRECATED errors:
  sql_regcase(), spliti(), split(), ereg_replace(), eregi(),
  ereg_replace(), and ereg().
  Use the PCRE family of functions (preg_*()) instead.

- mcrypt_generic_end() is deprecated.

- mysql_db_query() is deprecated.

- mysql_escape_string() is deprecated.

- session_register(), session_unregister(), and session_is_registered() are now
  deprecated. Use the $_SESSION superglobal array instead.

- Comments starting with '#' are now deprecated in .INI files.

- The following INI directives will now emit an E_DEPRECATED warning 
206 207 208 209 210 211 212 213 214
  upon startup if they are activated:

        - define_syslog_variables
        - register_globals
        - register_long_arrays
        - safe_mode
        - magic_quotes_gpc
        - magic_quotes_runtime
        - magic_quotes_sybase
215

216 217 218 219 220 221 222 223 224 225
- The is_dst parameter to mktime() is deprecated.

- Assigning the return value of "new" by reference is deprecated

- Call-time pass-by-reference has been deprecated

- Usage of {} to access string offsets is deprecated

- Passing locale category name as string to setlocale() is deprecated.

226 227 228
===============
6. Undeprecated
===============
229

230
- By popular request, is_a() is no longer deprecated.
231

232 233 234
==============
7. Extensions:
==============
235

236
     a. moved out to PECL and actively maintained there
237

238
        - fdf
239 240
        - ming
        - ncurses
241

242
     b. no longer maintained
243

244 245 246 247
        - dbase
        - fbsql
        - msql
        - sybase (use sybase_ct, which is still in PHP core)
248 249
        - mhash (hash has full BC layer)
        - mime_magic (use fileinfo, has full BC layer)
250

251
     c. with changed behaviour
252

253 254 255 256 257 258 259
        - dns: dns_check_record() will now return an extra "entries" index,
          containing the TXT elements.

        - datetime: date/time functions will no longer use the TZ environment
          variable to guess which timezone should be used.

        - cURL now supports SSH
260

261
        - hash: The SHA-224 and salsa hash algorithms are now supported.
262

263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
        - mbstring: Now supports CP850 encoding.

        - oci8: Database Resident Connection Pooling (DRCP) and Fast Application
          Notification (FAN) are now supported.

          Oracle External Authentication is now supported (except on Windows).

          The oci8 function oci_bind_by_name() now supports SQLT_AFC (aka the
          CHAR datatype).

          Calling oci_close() on a persistent connection, or when the variable
          that references a persistent connection goes out of scope, will now
          trigger a roll back of an uncommitted transaction. To avoid unexpected
          behavior explicitly issue a commit or roll back as needed. The old
          behavior can be enabled with the INI directive
          oci8.old_oci_close_semantics.

        - openssl: OpenSSL digest and cipher functions are now supported.
281 282
          It is also now possible to access the internal values of DSA, RSA and
          DH keys.
283

284
        - session: Sessions will no longer store session-files in "/tmp" when
285 286
          open_basedir restrictions apply, unless "/tmp" is explicitly added to
          the list of allowed paths.
287

288 289 290 291 292
        - SOAP: Now supports sending user-supplied HTTP headers.

        - MySQLi: Now supports persistent connections by prepending the hostname 
          with "p:".

293 294
        - imagepstext now rejects invalid antialiasing steps and raises a warning.

295
     d. no longer possible to disable
296

297 298 299
        - PCRE
        - Reflection
        - SPL
300

301 302 303
==========================
8. Changes in SAPI support
==========================
304

305 306
- A new "litespeed" SAPI is now available.

307 308
- FastCGI is now always enabled and can not be disabled. See sapi/cgi/CHANGES
  for more details.
309

310 311 312 313
- 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.
314
  See the new user_ini.filename and user_ini.cache_ttl INI directives.
315

316 317 318
============================
9. Changes in INI directives
============================
319

320 321
- zend_extension_debug and zend_extension_ts have been removed. Always use the
  zend_extension directive to load Zend Extensions.
322

323 324
- zend.ze1_compatibility_mode has been removed. If this INI directive is set to
  on, then an E_ERROR is emitted at startup.
325

326 327 328
- 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.
329

330 331
- Added mbstring.http_output_conv_mimetype. This directive specifies the
  regex pattern of content types for which mb_output_handler() is activated.
332

333 334
- It is now possible to use the full path to load modules using the "extension"
  directive.
335

336
- "INI variables" can now be used almost anywhere in a php.ini file.
337

338
- It is now possible to use alphanumeric or variable indices in INI option
339
  arrays.
340

341 342
- open_basedir is now PHP_INI_ALL

343
- Runtime tightening of open_basedir restrictions is now possible.
344

345 346 347 348 349 350
- The default value of session.use_only_cookies has changed to "1".

- The default value of oci8.default_prefetch has been changed from 10 to 100.

- A new directive, request_order, controls the behavior of $_REQUEST
  independently of variables_order.
351 352 353
- A new directive, called windows.show_crt_warning, has been introduced.
  This directive shows the CRT warnings when enabled. These warnings were
  displayed by default until now. It is disabled by default.
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379

- New INI directives: 
  - mail.add_x_header
  - user_ini.filename
  - user_ini.cache_ttl
  - exit_on_timeout
  - mysqli.allow_persistent
  - mysqli.default_host
  - mysqli.default_socket
  - mysqli.allow_local_infile
  - mysqli.cache_size
  - oci8.connection_class
  - oci8.events
  - pdo_mysql.default_socket
  - pdo_mysql.cache_size
  - sqlite3.extension_dir
  - mysql.default_socket
  - mysql.allow_local_infile
  - mysql.cache_size
  - mysqlnd.collect_statistics
  - mysqlnd.collect_memory_statistics
  - mysqlnd.net_cmd_buffer_size
  - mysqlnd.net_read_buffer_size
  - mysqlnd.log_mask


380 381 382
====================
10. Syntax additions
====================
383

384
- NOWDOC: Similar to HEREDOC, but with single quotes:
385 386 387 388 389 390 391 392 393 394

      <<<'LABEL' ...

  Static HEREDOCs can be used to initialize static variables and class members
  or constants:

      static $foo = <<<LABEL
      No variables here...
      LABEL;

395 396 397 398 399
- HEREDOC now supports wrapping the identifier with double-quotes, to complement
  the NOWDOC syntax:

      <<<"LABEL" ...

400 401 402 403
- The ?: operator has been introduced:

      var_dump(0 ?: 'Hello!');

404 405 406 407 408
- Namespaces were added:

      namespace my\name;
      $obj = new \my\name\MyClass;

409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
- Dynamic access to static methods is now possible:

      $foo::myFunc();

- Exceptions can now be nested:

      class MyCustomException extends Exception {}
      try {
          throw new MyCustomException("Something happend", 112);
      } catch(Exception $e) {
          throw new InvalidArgumentException("You are doing it wrong!", 911, $e);
      }

- Exceptions can now be handled in destructors.

- A garbage collector has been added and is enabled by default.

426 427 428 429
===================
11. Windows support
===================

430 431
- The minimum Windows version is now Windows 2000. (Windows 98, ME and NT4 are
  no longer supported).
432 433 434

- PHP Windows binaries target i586 or later. i386 and i486 are not supported.

435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
- Support for the IIS SAPI has been dropped. Use the FastCGI SAPI instead 
  (available for IIS5 and later)). FastCGI is the recommended way to use PHP
  with IIS (see http://php.iis.net/).

- A new build is available based on the latest Visual C++ Compiler (VC9). 
  Its use is recommended with FastCGI or CLI. Apache's Windows binaries are not
  compatible with VC9; however, you can use Apache Lounge's build
  (http://apachelounge.com).

- The x64 binaries are for experimental usage only. They are not meant to be 
  used in production.

- A new site is available to download Windows releases as well as Windows-only
  releases: http://windows.php.net. Windows-specific releases will be made to
  fix security issues in the bundled libraries (libpng, openssl, etc.). Please
  note that this site does not replace the main PHP site as a source of PHP
  news, resources, or documentation.

453
- Windows support has been added for the following functions: getopt(),
454 455 456
  imagecolorclosesthwb(), mcrypt_create_iv(), inet_ntop(), inet_pton(), 
  getmxrr(), checkdnsrr(), dns_get_record(), linkinfo(), readlink(), 
  symlink(), link(), fnmatch(), stream_socket_pair(), time_nanosleep(), 
457 458 459
  time_sleep_until(), and socket_create_pair().

- Crypt supports now all available algorithms on Windows (blowfish included).
460 461

- Improved portability of stat(), touch(), filemtime(), filesize() and related
462 463 464 465 466
  functions (100% portable for the available data).

- It is now possible to create hard links on Windows using the link() function,
  and symbolic links using the symlink() function. Hard links are available
  as of Windows 2000 and symbolic links as of Windows Vista.
467 468

- The PDO_OCI php_pdo_oci8.dll library (for use with Oracle version 8 client
469 470 471
  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 still supported.
472

473 474 475 476 477
- 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 still
  supported.
478

479 480
- Firebird and SNMP support are no longer available on Windows. Firebird support
  may be reintroduced in the future.
481

482 483 484 485 486 487 488 489
=====================
11.1 New in PHP 5.3.4
=====================

- open_basedir supports now symbolic links (checks the target).
- is_link and SplFileInfo symbolic links related method are now fully supported
  (on Windows Vista or later).

490 491 492 493 494 495 496
===================
12. New in PHP 5.3:
===================

     a. New libraries

       - mysqlnd is a new core library shipped with PHP. It is a PHP-specific
497 498
         replacement for libmysql and is recommended for all installations for
         increased performance.
499 500 501

     b. New extensions

502 503
       - enchant
       - fileinfo (replaces mime_magic)
504 505 506 507 508 509 510 511 512
       - intl
       - Phar
       - SQLite3

     c. New stream wrappers

       - glob:// stream wrapper
       - phar:// stream wrapper for accessing phar archives

513 514 515 516 517 518
     d. New stream filters

       - "dechunk" (HTTP/1.1 chunked transfer encoding)
       - The bz2.decompress filter now supports concatenation

     e. New functions
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538

       - Core:    gc_collect_cycles()
                  gc_enabled()
                  gc_enable()
                  gc_disable()
                  class_alias()
                  get_called_class()
                  forward_static_call()
                  forward_static_call_array()
                  str_getcsv()
                  quoted_printable_encode()
                  lcfirst()
       - Array:   array_replace()
                  array_replace_recursive()
       - Date:    date_add()
                  date_sub()
                  date_diff()
                  date_parse_from_format()
                  date_create_from_format()
                  date_get_last_errors()
539
                  timezone_version_get()
540 541 542
       - INI:     parse_ini_string()
       - GMP:     gmp_testbit()
       - Hash:    hash_copy()
543 544 545
       - IMAP:    imap_gc()
                  imap_utf8_to_mutf7()
                  imap_mutf7_to_utf8()
546
       - JSON:    json_last_error()
547
       - libxml:  libxml_disable_entity_loader
548 549 550 551
       - MySQLi:  mysqli_fetch_all()
                  mysqli_get_connection_stats()
                  mysqli_poll()
                  mysqli_reap_async_query()
552 553
       - Network: gethostname()
                  header_remove()
554 555 556 557 558 559 560
       - OpenSSL: openssl_random_pseudo_bytes()
       - PCNTL:   pcntl_signal_dispatch()
                  pcntl_sigprocmask()
                  pcntl_sigwaitinfo()
                  pcntl_sigtimedwait()
       - PCRE:    preg_filter()
       - SHM:     msg_queue_exists()
561
                  shm_has_var()
562 563
       - Streams: stream_supports_lock()
                  stream_context_set_default()
564 565 566 567
                  stream_context_get_params()
       - Userspace stream wrappers:
                  stream_cast()
                  stream_set_options()
568

569
     f. New global constants
570 571 572 573 574

       - Core:    E_DEPRECATED
                  E_USER_DEPRECATED
                  __DIR__
                  __NAMESPACE__
575 576 577 578 579 580 581 582 583 584 585 586
                  PHP_MAXPATHLEN
                  PHP_WINDOWS_VERSION_MAJOR
                  PHP_WINDOWS_VERSION_MINOR
                  PHP_WINDOWS_VERSION_BUILD
                  PHP_WINDOWS_VERSION_PLATFORM
                  PHP_WINDOWS_VERSION_SP_MAJOR
                  PHP_WINDOWS_VERSION_SP_MINOR
                  PHP_WINDOWS_VERSION_SUITEMASK
                  PHP_WINDOWS_VERSION_PRODUCTTYPE
                  PHP_WINDOWS_NT_DOMAIN_CONTROLLER
                  PHP_WINDOWS_NT_SERVER
                  PHP_WINDOWS_NT_WORKSTATION
587 588
       - INI:     INI_SCANNER_NORMAL
                  INI_SCANNER_RAW
589
       - cURL     CURLOPT_PROGRESSFUNCTION
590 591 592 593 594 595
       - GD:      IMG_FILTER_PIXELATE
       - JSON:    JSON_ERROR_NONE
                  JSON_ERROR_DEPTH
                  JSON_ERROR_STATE_MISMATCH
                  JSON_ERROR_CTRL_CHAR
                  JSON_ERROR_SYNTAX
596 597 598 599 600
                  JSON_FORCE_OBJECT
                  JSON_HEX_TAG
                  JSON_HEX_AMP
                  JSON_HEX_APOS
                  JSON_HEX_QUOT
601
       - LDAP:    LDAP_OPT_NETWORK_TIMEOUT
602
       - libxml:  LIBXML_LOADED_VERSION 
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
       - PCRE:    PREG_BAD_UTF8_OFFSET_ERROR
       - PCNTL:   SIG_BLOCK
                  SIG_UNBLOCK
                  SIG_SETMASK
                  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

652
     g. New classes
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672

       - Date:    DateInterval
                  DatePeriod
       - Phar:    Phar
                  PharData
                  PharFileInfo
                  PharException
       - SPL      SplDoublyLinkedList
                  SplStack
                  SplQueue
                  SplHeap
                  SplMinHeap
                  SplMaxHeap
                  SplPriorityQueue
                  SplFixedArray
                  FilesystemIterator
                  GlobIterator
                  RecursiveTreeIterator
                  MultipleIterator

673
     h. New methods
674 675 676 677 678 679

       - Date:         DateTime::diff()
                       DateTime::add()
                       DateTime::sub()
                       DateTime::createFromFormat()
                       DateTime::getLastErrors()
680 681
       - DOM:          DOMNode::getLineNo()
       - Exception:    Exception::getPrevious()
682 683
       - PDO_Firebird: PDO::setAttribute()
       - Reflection:   ReflectionProperty::setAccessible()
684 685 686 687 688 689
                       ReflectionFunction::inNamespace()
                       ReflectionFunction::getNamespaceName()
                       ReflectionFunction::getShortName()
                       ReflectionClass::inNamespace()
                       ReflectionClass::getNamespaceName()
                       ReflectionClass::getShortName()
690 691 692
       - SPL:          DirectoryIterator::getExtension()
                       SplFileInfo::getExtension()
                       SplObjectStorage::addAll()
693
                       SplObjectStorage::removeAll()
694 695
       - XSL:          XSLTProcessor::setProfiling()

696
     i. New class constants
697 698 699 700

       - PDO_Firebird: PDO::FB_ATTR_DATE_FORMAT
                       PDO::FB_ATTR_TIME_FORMAT
                       PDO::FB_ATTR_TIMESTAMP_FORMAT