mirror of
https://github.com/php/php-src.git
synced 2024-12-02 22:34:55 +08:00
3b0f051193
Albeit CSV is still a widespread data exchange format, it has never been officially standardized. There exists, however, the “informational” RFC 4180[1] which has no notion of escape characters, but rather defines `escaped` as strings enclosed in double-quotes where contained double-quotes have to be doubled. While this concept is supported by PHP's implementation (`$enclosure`), the `$escape` sometimes interferes, so that `fgetcsv()` is unable to correctly parse externally generated CSV, and `fputcsv()` is sometimes generating non-compliant CSV. Since PHP's `$escape` concept is availble for many years, we cannot drop it for BC reasons (even though many consider it as bug). Instead we allow to pass an empty string as `$escape` parameter to the respective functions, which results in ignoring/omitting any escaping, and as such is more inline with RFC 4180. It is noteworthy that this is almost no userland BC break, since formerly most functions did not accept an empty string, and failed in this case. The only exception was `str_getcsv()` which did accept an empty string, and used a backslash as escape character then (which appears to be unintended behavior, anyway). The changed functions are `fputcsv()`, `fgetcsv()` and `str_getcsv()`, and also the `::setCsvControl()`, `::getCsvControl()`, `::fputcsv()`, and `::fgetcsv()` methods of `SplFileObject`. The implementation also changes the type of the escape parameter of the PHP_APIs `php_fgetcsv()` and `php_fputcsv()` from `char` to `int`, where `PHP_CSV_NO_ESCAPE` means to ignore/omit escaping. The parameter accepts the same values as `isalpha()` and friends, i.e. “the value of which shall be representable as an `unsigned char` or shall equal the value of the macro `EOF`. If the argument has any other value, the behavior is undefined.” This is a subtle BC break, since the character `chr(128)` has the value `-1` if `char` is signed, and so likely would be confused with `EOF` when converted to `int`. We consider this BC break to be acceptable, since it's rather unlikely that anybody uses `chr(128)` as escape character, and it easily can be fixed by casting all `escape` arguments to `unsigned char`. This patch implements the feature requests 38301[2] and 51496[3]. [1] <https://tools.ietf.org/html/rfc4180> [2] <https://bugs.php.net/bug.php?id=38301> [3] <https://bugs.php.net/bug.php?id=51496>
71 lines
2.4 KiB
Plaintext
71 lines
2.4 KiB
Plaintext
PHP NEWS
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
?? ??? ????, PHP 7.4.0alpha1
|
|
|
|
- CURL:
|
|
. Fixed bug #76480 (Use curl_multi_wait() so that timeouts are respected).
|
|
(Pierrick)
|
|
|
|
- Date:
|
|
. Fixed bug #75232 (print_r of DateTime creating side-effect). (Nikita)
|
|
|
|
- FPM:
|
|
. Implemented FR #72510 (systemd service should be hardened). (Craig Andrews)
|
|
|
|
- GD:
|
|
. Fixed bug #73291 (imagecropauto() $threshold differs from external libgd).
|
|
(cmb)
|
|
. Fixed bug #76324 (cannot detect recent versions of freetype with
|
|
pkg-config). (Eli Schwartz)
|
|
. The bundled libgd behaves now like system libgd wrt. IMG_CROP_DEFAULT never
|
|
falling back to IMG_CROP_SIDES.
|
|
. The default $mode parameter of imagecropauto() has been changed to
|
|
IMG_CROP_DEFAULT; passing -1 is now deprecated.
|
|
|
|
- Hash:
|
|
. The hash extension is now an integral part of PHP and cannot be disabled
|
|
as per RFC: https://wiki.php.net/rfc/permanent_hash_ext. (Kalle)
|
|
|
|
- Intl:
|
|
. Lifted requirements to ICU ≥ 50.1. (cmb)
|
|
. Changed default of $variant parameter of idn_to_ascii() and idn_to_utf8().
|
|
(cmb)
|
|
|
|
- Opcache:
|
|
. Implemented preloading RFC: https://wiki.php.net/rfc/preload. (Dmitry)
|
|
|
|
- OpenSSL:
|
|
. Added openssl_x509_verify function. (Ben Scholzen)
|
|
|
|
- PDO_OCI:
|
|
. Implemented FR #76908 (PDO_OCI getColumnMeta() not implemented).
|
|
(Valentin Collet, Chris Jones, Remi)
|
|
|
|
- PDO_SQLite:
|
|
. Implemented sqlite_stmt_readonly in PDO_SQLite. (BohwaZ)
|
|
. Lifted requirements to SQLite 3.5.0. (cmb)
|
|
|
|
- Sockets:
|
|
. Fixed bug #67619 (Validate length on socket_write). (thiagooak)
|
|
|
|
- SQLite3:
|
|
. Unbundled libsqlite. (cmb)
|
|
. Lifted requirements to SQLite 3.7.4. (cmb)
|
|
. Forbid (un)serialization of SQLite3, SQLite3Stmt and SQLite3Result. (cmb)
|
|
. Added support for the SQLite @name notation. (cmb, BohwaZ)
|
|
|
|
- Standard:
|
|
. Fixed bug #74764 (Bindto IPv6 works with file_get_contents but fails with
|
|
stream_socket_client). (Ville Hukkamäki)
|
|
. Implemented FR #38301 (field enclosure behavior in fputcsv). (cmb)
|
|
. Implemented FR #51496 (fgetcsv should take empty string as an escape). (cmb)
|
|
|
|
- Reflection:
|
|
. Fixed bug #76737 (Unserialized reflection objects are broken, they
|
|
shouldn't be serializable). (Nikita)
|
|
|
|
- Tidy:
|
|
. Added TIDY_TAG_* constants for HTML5 elements. (cmb)
|
|
|
|
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
|