1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 00:48:25 +02:00
Commit Graph

1043 Commits

Author SHA1 Message Date
Zeev Suraski 0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Andreas Treichel b1e9c73b27 Allow strip_tags with an array of allowed tagnames 2019-01-24 15:56:32 +01:00
Nikita Popov 1bc86bcdd8 Merge branch 'PHP-7.3' 2019-01-18 15:03:00 +01:00
Nikita Popov 986b9b5ae3 Add additional no_sanitize_address attributes
To fix bug #77447 in release mode as well.
2019-01-18 15:02:30 +01:00
Nikita Popov e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Christoph M. Becker 3b0f051193 Allow empty $escape to eschew escaping CSV
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>
2018-12-15 14:38:15 +01:00
Zeev Suraski 9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski 67e0138c0d Future-proof email addresses... 2018-11-01 18:30:28 +02:00
Dmitry Stogov 359f19edc9 Optimize substr() edge-case conditions 2018-10-29 13:11:41 +03:00
Peter Kokot 8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Nikita Popov f4a9da389b Deprecate non-string needles in string search functions
Part of https://wiki.php.net/rfc/deprecations_php_7_3.
2018-07-21 22:34:09 +02:00
Dmitry Stogov 5cf6474277 Flatten strip_tags state machine (GCC overoptimized this function, producing enormpous amount of code). 2018-07-16 13:22:17 +03:00
Dmitry Stogov 67b4c3379a Uze ZVAL_COPY_DEREF() instead of ZVAL_DEREF() and ZVAL_COPY() 2018-07-09 12:46:46 +03:00
Dmitry Stogov 14e6c0cb8c str_replace() micro-optimization 2018-07-03 17:47:08 +03:00
Dmitry Stogov dd932f7e63 Changed php_add[c]slashes prototypes (removed should_free argument) 2018-06-29 00:19:16 +03:00
Dmitry Stogov 5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov 524f5245c5 Avoid useless checks, using zend_string_efree(), in cases where the string is known to be a temporary allocated zend_string. 2018-05-08 17:30:15 +03:00
Nikita Popov 3182292015 Fix unused variable warnings 2018-04-26 16:53:58 +02:00
David Carlier 86cff0bd4c Avoid using _N in SSE code
The _N constant is already defined in OpenSSL. Instead use some
more explicit variable names.
2018-04-26 16:50:19 +02:00
Khan M Rashedun-Naby ef79b3ae0c Author Name Character Fix 2018-04-06 08:37:09 +02:00
Anatol Belski bb2bfa6213 Use const pointers 2018-03-17 12:45:22 +01:00
Anatol Belski fa9ea3c9eb Use const pointers where appropriate 2018-03-16 20:37:51 +01:00
Anatol Belski 0097619925 Use const pointers at some appropriate places 2018-03-16 15:43:30 +01:00
Xinchen Hui 5a0b8c125a slashchars are 16 bytes aligned 2018-03-16 16:01:32 +08:00
Xinchen Hui 4353e1100e Fixed folder 2018-03-16 13:23:35 +08:00
Xinchen Hui 9f456d6880 Optimized str_rot13 with SSE2 instructions 2018-03-16 10:52:57 +08:00
Xinchen Hui 13eca3d428 Avoding memory allocation 2018-02-26 16:54:53 +08:00
Xinchen Hui fd88e7e3a1 Avoding memory allocation 2018-02-26 16:48:49 +08:00
zufuliu bff179888f Improve similar_text(), reduce recursive call to php_similar_char()
If the longest common substring is the leftmost common substring, there
is no need to check the string prefixes for further common substrings,
since there are none.
2018-02-22 15:59:24 +01:00
Anatol Belski bc3de8caea Fix def signature to match declaration 2018-02-21 11:53:38 +01:00
Xinchen Hui 91635b011b Optimized php_stripslash with SSSE3 instr 2018-02-21 10:09:11 +08:00
Xinchen Hui 5091f5ff9c Simplified the codes (the penalty of loading unaligned address is negligible) 2018-02-20 20:56:23 +08:00
Xinchen Hui 22e7329d9a change layout 2018-02-18 19:47:41 +08:00
Xinchen Hui ac5cdd46f3 Move map out of loop 2018-02-18 19:34:48 +08:00
Xinchen Hui c79f2de2cf Optimized strrev with SSSE3
since strrev is not wildly used, and SSSE3 is defined default by some
compiler, so won't try to do ifunc here.
2018-02-17 23:19:31 +08:00
Xinchen Hui ab9162426b change argument parsing 2018-02-17 22:29:59 +08:00
Xinchen Hui cf0fae5e97 Optimized base64_encode/decode with SIMD instructions 2018-02-12 20:53:14 +08:00
Xinchen Hui 7ce72f0cf5 Merge branch 'master' of git.php.net:/php-src
* 'master' of git.php.net:/php-src: (37 commits)
  Avoid conditions inside loop
  Improve loop vectorization
  Improve loop vectorization
  Remove unused function
  Fixed bug #75938
  Remove unused files
  Fixed bug #75940 Unnecessary compile wrapper with PHP_THREAD_SAFETY=yes
  typo
  Update README.GIT-RULES
  Fix SKIPIF section
  Fixes bug #75871 Use pkg-config for libxml2 if available
  Fixed bug #49876 lib path on 64bit distros
  Refactor testing READMEs
  Fixed bug #65414
  Fixed bug #65414
  Fixed bug #74519 strange behavior of AppendIterator
  fix #74519 strange behavior of AppendIterator
  Use bool instead of boolean
  Remove space between function name and open parentheses
  Fix some misspellings
  ...
2018-02-10 17:01:55 +08:00
Xinchen Hui 87b7180480 Fixed cpu feature check in reslover functions 2018-02-10 16:58:27 +08:00
Gabriel Caruso 2d48d734a2 Fix some misspellings 2018-02-06 16:59:00 +01:00
Gabriel Caruso affc20f891 Use bool instead of boolean in proto 2018-02-04 17:00:24 +01:00
Anatol Belski a06cde8236 If the target attribute is available, attach it explicitly
The ifunc attribute might be not available as it is binary format
dependent.
2018-02-03 17:18:41 +01:00
Anatol Belski 92f9fde23a Macrify the common operation 2018-01-24 18:35:40 +01:00
Anatol Belski 7e2a9936d3 Move useful macro into zend_portability.h 2018-01-24 10:14:28 +01:00
Anatol Belski a6e86f7a3f Implement intrinsic function resolving per MINIT 2018-01-24 09:33:32 +01:00
Anatol Belski 8d4b57f62c Add missing closing fold 2018-01-17 20:48:13 +01:00
Xinchen Hui 5618a5cfd9 Don't use ifunc if compiling with __SSE4_2__ deinfed 2018-01-17 17:31:10 +08:00
Xinchen Hui 3a3e0493d0 Added ZEND_API zend_cpu_supports 2018-01-16 14:53:00 +08:00
Xinchen Hui 0b7a968109 Added missed PHPAPI 2018-01-15 21:39:25 +08:00
Xinchen Hui 98aa3a65c4 Optimized php_addslashes with SSE4.2 instructions
According to benchmark
(https://gist.github.com/laruence/fd0d443d2c5bacca9d8ab99250499956) this brings 30%+ execution time reduced.

In the further, this open the door for possible SSE4.2 optimizations in
other places.
2018-01-15 21:17:50 +08:00