Commit graph

1245 commits

Author SHA1 Message Date
Peter Kokot
638c21765c Remove HAVE_STRCOLL check
The strcoll function is defined in the C89 standard and should be
on today's systems always available via the <string.h> header.

https://port70.net/~nsz/c/c89/c89-draft.html#4.11.4.3

- Remove also SKIPIF strcoll check in test
2019-06-28 00:05:55 +02:00
Nikita Popov
6aaab9adf7 Merge branch 'PHP-7.4' 2019-06-20 16:24:31 +02:00
Nikita Popov
d4de127dd8 In php_needle_char() use well-defined double->integer cast
...by going through zval_get_long(). Generally out of range double
casts are undefined.
2019-06-20 16:22:10 +02:00
Nikita Popov
e8ae19223c Avoid address calculation overflow 2019-06-20 16:22:04 +02:00
Tyson Andre
cdc82f19d8
Fix php 8.0's opcache flags for pathinfo()
See https://php.net/pathinfo

This fixes a bug introduced in the cleanup for commit
0d79c70cf3

`pathinfo($str, PATHINFO_EXTENSION)` will always return a string
(if there is no extension, the function returns the empty string)
2019-06-11 09:09:50 +02:00
Christoph M. Becker
b30d54ce05 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #77937: preg_match failed
2019-06-11 08:45:32 +02:00
Christoph M. Becker
27e592d3ce Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77937: preg_match failed
2019-06-11 08:44:54 +02:00
Christoph M. Becker
b215d1339f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77937: preg_match failed
2019-06-11 08:44:07 +02:00
Christoph M. Becker
f3ff72e54b Fix #77937: preg_match failed
On some recent Windows systems, ext\pcre\tests\locales.phpt fails,
because 'pt_PT' is accepted by `setlocale()`, but not properly
supported by the ctype functions, which are used internally by PCRE2 to
build the localized character tables.

Since there appears to be no way to properly check whether a given
locale is fully supported, but we want to minimize BC impact, we filter
out typical Unix locale names, except for a few cases which have
already been properly supported on Windows.  This way code like

  setlocale(LC_ALL, 'de_DE.UTF-8', 'de_DE', 'German_Germany.1252');

should work like on older Windows systems.

It should be noted that the locale names causing trouble are not (yet)
documented as valid names anyway, see
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/locale-names-languages-and-country-region-strings?view=vs-2019>.
2019-06-11 08:42:32 +02:00
Dmitry Stogov
e029cc4dd4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Cheaper checks for exceptions thrown from __toString()
2019-06-06 02:23:17 +03:00
Dmitry Stogov
457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03:00
Nikita Popov
7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +02:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Gabriel Caruso
7393777da9 Add return type for string functions 2019-06-01 11:52:06 -03:00
Nikita Popov
0ba34824f5 Use TypeError instead of warning in implode()
These are again manual argument type checks.
2019-05-31 11:04:13 +02:00
Nikita Popov
4da316d189 hebrev/hebrevc: Don't return false for empty string
There is nothing special about the empty string in this context,
we should pass it through unchanged.
2019-05-28 13:12:38 +02:00
Nikita Popov
0d79c70cf3 Update MAY_BE_NULL info for more ext/standard functions 2019-05-28 13:12:38 +02:00
Nikita Popov
d95c15e371 Update MAY_BE_NULL for parts of ext/standard
Also update proto comments to be more accurate.
2019-05-28 12:11:32 +02:00
Gabriel Caruso
a437f065b8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Make chr ZPP failure message consistent with ext/standard
2019-05-18 16:17:06 -03:00
Gabriel Caruso
714d9fc358 Make chr ZPP failure message consistent with ext/standard 2019-05-18 15:59:07 -03:00
Christoph M. Becker
6d9ca44851 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78003: strip_tags output change since PHP 7.3
2019-05-13 13:11:40 +02:00
Christoph M. Becker
2e8518fdcf Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78003: strip_tags output change since PHP 7.3
2019-05-13 13:11:07 +02:00
Christoph M. Becker
69bab6e5a5 Fix #78003: strip_tags output change since PHP 7.3
A refactoring of the strip tags state machine[1] missed the special
treatment of `depth > 0` when a `>` is encountered in state 2 or 3.  We
re-add it for BC reasons.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=5cf64742773ddbf9af69d962a4d12b567fcf0084>
2019-05-13 13:10:24 +02:00
Nikita Popov
49c4ab3c39 Merge branch 'PHP-7.4' 2019-05-07 10:41:31 +02:00
Sebastian Pop
68a7578243 [AArch64] use rev64 to reverse strings
The execution time goes from 4.388s down to 0.563s on a Graviton A1
instance for the benchmark:

function reverse_strings() {
    $a = "foo";
    for ($i = 0; $i < 100000; $i++) {
        strrev($a);
        $a .= "o";
    }
}
2019-05-07 10:40:45 +02:00
Dmitry Stogov
e188e4170f Use ZEND_TRY_ASSIGN_REF_... macros for arguments passed to internal function by reference 2019-04-24 18:28:29 +03:00
Dmitry Stogov
2e4686b566 Use ZEND_TRY_ASSIGN_REF_... macros for arguments passed to internal function by reference 2019-04-24 18:16:47 +03:00
Dmitry Stogov
34db07567d Use ZEND_TRA_ASSIGN_REF_... macros for by reference arguments of internal functions. 2019-04-24 16:14:48 +03:00
Nikita Popov
3fab73e24e Avoid misc uninitialized variable warnings 2019-04-12 15:12:45 +02:00
Nikita Popov
339b0af429 Avoid misc uninitialized variable warnings 2019-04-12 15:12:39 +02:00
Peter Kokot
a36c856b0a Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove HAVE_STRERROR
2019-04-08 23:40:46 +02:00
Peter Kokot
e6a6017f78 Remove HAVE_STRERROR
Checking for the strerror function presence is no longer needed since it
is part of the C89 standard [1] and can be safely assumed that all
current systems have it.

Check in the configure.ac and Windows defined symbol are still left
until the file library (libmagic) will be updated.

[1]: https://port70.net/~nsz/c/c89/c89-draft.html
2019-04-08 23:39:45 +02:00
Nikita Popov
aebf80e52d Merge branch 'PHP-7.4' 2019-04-08 11:42:34 +02:00
Nikita Popov
c3ca4dd53e Merge branch 'PHP-7.3' into PHP-7.4 2019-04-08 11:41:53 +02:00
Nikita Popov
08a3062816 Merge branch 'PHP-7.2' into PHP-7.3 2019-04-08 11:41:48 +02:00
Nikita Popov
d7b5954f28 Fixed bug #77853 2019-04-08 11:40:50 +02:00
Peter Kokot
e6f86fb17c Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove checks for locale.h, setlocale, localeconv
2019-04-07 18:34:02 +02:00
Peter Kokot
e06836a1a3 Remove checks for locale.h, setlocale, localeconv
The `<loccale.h>` header file, setlocale, and localeconv are part of the
standard C89 [1] and on current systems can be used unconditionally.

Since PHP 7.4 requires at least C89 or greater, the `HAVE_LOCALE_H`,
`HAVE_SETLOCALE`, and `HAVE_LOCALECONV` symbols defined by Autoconf in
configure.ac [2] can be ommitted and simplifed.

The bundled libmagic (file) has also been patched already in version
5.35 and up in upstream location so when it will be patched also in
php-src the check for locale.h header is still left in the configure.ac
and in windows headers definition file.

[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.4
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4

Omit the bundled libmagic files
2019-04-07 18:32:54 +02:00
Peter Kokot
309edb070d Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove HAVE_LIMITS_H
2019-04-07 15:21:48 +02:00
Peter Kokot
fd1ad1e25a Remove HAVE_LIMITS_H
The `<limits.h>` header file is part of the standard C89 headers [1]
and on current systems can be included unconditionally.

Since PHP requires at least C89 or greater, the `HAVE_LIMITS_H` symbol
defined by Autoconf in configure.ac [2] can be ommitted and simplifed
however due to bundled file library (libmagic) and timelib still using
it, the removal there was omitted and done only in Zend.m4 file.

Current bundled libraries libtime, oniguruma, and libmagic still include
partial `HAVE_LIMITS_H` usage and will be more refactored when this is
possible.

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
2019-04-07 15:20:02 +02:00
Anatol Belski
ba2269ab9e Fix memory leak 2019-03-30 23:04:52 +01:00
Nikita Popov
879cd04913 Merge branch 'PHP-7.4' 2019-02-18 17:51:41 +01:00
Tyson Andre
9249d82019 Fix typos in code comments [skip ci] 2019-02-18 17:48:12 +01:00
Nikita Popov
bd13c209ab Merge branch 'PHP-7.4' 2019-02-14 11:50:06 +01:00
Nikita Popov
96daef0458 Make ABI of SIMD optimized functions independent of compiler flags
Always export these as normal functions and only use function pointers
internally if necessary.
2019-02-14 11:49:21 +01:00
Nikita Popov
fdb85a828a Return empty str from quotemeta() on empty str 2019-02-11 09:58:10 +01:00
Peter Kokot
623911f993 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove local variables
2019-02-03 21:23:18 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Zeev Suraski
38c337f22e Remove year range from copyright notice 2019-01-30 11:00:23 +02:00