UPGRADING.INTERNALS 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. PHP 8.1 INTERNALS UPGRADE NOTES
  2. 1. Internal API changes
  3. a. Removed Zend APIs
  4. b. Zend Stream API
  5. c. zend_get_opcode_id()
  6. d. Removed support for "p" printf format specifier
  7. e. ZEND_ATOL() changes
  8. f. Non-serializable classes should use ZEND_ACC_NOT_SERIALIZABLE
  9. g. _zend_hash_find_known_hash renamed to zend_hash_find_known_hash
  10. h. Renaming of ZEND_TYPE_HAS_CLASS() into ZEND_TYPE_IS_COMPLEX()
  11. i. zend_resource handle is now zend_long
  12. 2. Build system changes
  13. a. New compiler flags
  14. 3. Module changes
  15. a. ext/hash
  16. b. ext/pdo
  17. c. ext/standard
  18. d. ext/pgsql
  19. e. ext/pcre
  20. ========================
  21. 1. Internal API changes
  22. ========================
  23. a. The following APIs have been removed from the Zend Engine:
  24. - The spl_ce_Aggregate, spl_ce_ArrayAccess, spl_ce_Countable, spl_ce_Iterator, spl_ce_Serializable,
  25. spl_ce_Stringable, spl_ce_Traversable alias class entries have been removed in favor of zend_ce_aggregate,
  26. zend_ce_arrayaccess, zend_ce_countable, zend_ce_iterator, zend_ce_serializable, zend_ce_stringable,
  27. zend_ce_traversable.
  28. - The ZVAL_NEW_ARR() macro has been removed. Use array_init() or ZVAL_ARR
  29. with zend_new_array() instead.
  30. - The IGNORE_URL_WIN macro has been removed; it had no effect as of PHP 5.0.0.
  31. - TsHashTable has been removed, it was not used in php-src and was not useful outside of php-src.
  32. b. Zend Stream API has been changed to use "zend_string*" instead of "char*"
  33. - zend_file_handle.filename now is zend_string*
  34. - zend_file_handle.free_filename is removed. Now zend_file_handle.filename is always released.
  35. - added zend_file_handle.primary_script flag. SAPIs should set it for main executed script.
  36. - added zend_file_handle.in_list flag, which is set when a file_handle is added into CG(open_files)
  37. - added zend_stream_init_filename_ex() function, that takes filename as zend_string*
  38. - the "filename" parameter of functons zend_stream_open(), php_stream_open_for_zend_ex() and
  39. callback zend_stream_open_function() has been removed (it's now passed as a "filename" field of the
  40. file_handle parameter)
  41. - in zend_fopen() and zend_resolve_path() callbacks filename now passed as zend_string*
  42. - file_handles should be destroyed by zend_destroy_file_handle() function (usually in the same function
  43. the same function where they were created by zend_stream_init_*()). Previously there were two different
  44. destructors zend_destroy_file_handle() and zend_file_handle_dtor().
  45. - zend_ini_scanner_globals.filename now is zend_string*
  46. c. Added the zend_get_opcode_id() function, which is intended to get opcode id from name.
  47. d. Removed support for "p" modifier (%pd, %pu, etc) in PHP's printf
  48. implementations. Use ZEND_LONG_FMT and ZEND_ULONG_FMT instead.
  49. e. ZEND_ATOL() now returns the integer instead of assigning it as part of the
  50. macro. Replace ZEND_ATOL(i, s) with i = ZEND_ATOL(s).
  51. f. Non-serializable classes should be indicated using the
  52. ZEND_ACC_NOT_SERIALIZABLE (@not-serializable in stubs) rather than the
  53. zend_class_(un)serialize_deny handlers which are removed.
  54. g. _zend_hash_find_known_hash has been renamed to zend_hash_find_known_hash.
  55. h. ZEND_TYPE_HAS_CLASS() has been renamed to ZEND_TYPE_IS_COMPLEX() for clarity.
  56. A zend_type element can contain a zend_type_list which might be either a union or an intersection,
  57. or a single class stored as either a zend_string* or a zend_class_entry*.
  58. i. The handle member of zend_resource (the resource ID) now has type zend_long
  59. rather than int. This should be transparent to most code, but uses in
  60. printf may need to switch from "%d" to ZEND_LONG_FMT.
  61. ========================
  62. 2. Build system changes
  63. ========================
  64. a. New compiler flags
  65. - [-Wimplicit-fallthrough=1] is now enabled by default.
  66. It is possible to use the new ZEND_FALLTHROUGH macro keyword to suppress the warning.
  67. ========================
  68. 3. Module changes
  69. ========================
  70. a. ext/hash
  71. - The init signatures are extended with an additional `HashTable*`
  72. argument. The passed HT is to contain the algorithm specific
  73. configuration. If an algorithm doesn't make use of any additional
  74. configuration, the argument is to be marked with ZEND_ATTRIBUTE_UNUSED.
  75. b. ext/pdo
  76. - The "preparer" callback now accepts a zend_string* instead of
  77. char* + size_t pair the query string. Similarly, the query_string and
  78. active_query_string members of pdo_stmt_t are now zend_string*.
  79. - The way in which drivers provide results has changed: Previously,
  80. the "describer" callback populated the "pdo_type" member in the
  81. pdo_column_data structure, and the "get_col" callback then had to return
  82. pointers to data of appropriate type.
  83. In PHP 8.1, the "describer" callback no longer determines the pdo_type
  84. (and this member has been removed from pdo_column_data). Instead, the
  85. "get_col" callback accepts a zval pointer that may be populated with a
  86. value of arbitrary type. This gives drivers more flexibility in
  87. determining result types (e.g. based on whether a specific integer fits
  88. the PHP integer type) and avoid awkward juggling of temporary buffers.
  89. As the "describer" no longer determines pdo_type, the "get_column_meta"
  90. function is now responsible for providing this information for use by
  91. getColumnMeta(). The type provided here does not need to match the type
  92. returned by get_col (in fact no corresponding type might exist, e.g. for
  93. floats). It should be the closest logical equivalent for the column type.
  94. - The transaction, set_attribute, and preparer handler's return type
  95. has been formalized to bool instead of int.
  96. - The check_liveness handler's return type has been formalized to zend_return
  97. instead of int.
  98. - The closer, and fetch_error handlers have been voidified.
  99. - The quoter handler now returns the quoted string as zend_string* instead
  100. of returning a boolean, and the quoted string as a pair of out params.
  101. Similarly the unquoted string is now a zend_string* instead of a pair of
  102. char* and size_t length.
  103. - The doer handler now accepts a zend_string* instead of char* + size_t
  104. pair for the SQL statement.
  105. - The last_id handler now returns a zend_string* instead of returning a
  106. char* and the length as an out param, and accepts a zend_string* instead
  107. of char* for the optional sequence/table name.
  108. - The php_pdo_str_tolower_dup() PDO_API has been removed use zend_str_tolower_dup()
  109. or zend_string_tolower_ex().
  110. c. ext/standard
  111. - The PHP API php_fputcsv() now takes an extra zend_string* argument at the end
  112. for a custom EOL sequence, passing NULL provides the old default of "\n".
  113. d. ext/pgsql
  114. - The functions php_pgsql_meta_data(), php_pgsql_convert(), php_pgsql_insert(),
  115. php_pgsql_update(), php_pgsql_delete(), and php_pgsql_select() have had
  116. their return type formalized to zend_result.
  117. - The functions php_pgsql_meta_data(), php_pgsql_convert(), php_pgsql_insert(),
  118. php_pgsql_update(), php_pgsql_delete(), and php_pgsql_select() now accept a
  119. zend_string* instead of a char* for the table name.
  120. e. ext/pcre
  121. - Bundled PCRE2 is at version 10.37. The most important diff to the previous
  122. version is the JIT support on the S390 platform.