]> granicus.if.org Git - php/log
php
4 years agoUse unused attribute for _dummy
Nikita Popov [Fri, 12 Jun 2020 08:18:19 +0000 (10:18 +0200)]
Use unused attribute for _dummy

The (void)_dummy is apparently considered a read of an uninitialized
variable. As it is a _Bool now, which has trap representations, this
is no longer considered legal and results in somewhat odd ubsan
warnings of the form:

runtime error: load of value 0, which is not a valid value for type 'zend_bool' (aka 'bool')

4 years agoFix null pointer ub in encoding parsing
Nikita Popov [Fri, 12 Jun 2020 08:05:16 +0000 (10:05 +0200)]
Fix null pointer ub in encoding parsing

And do a bit of drive-by cleanup by extracting count_commas and
reducing some variable scopes.

4 years agoUpdate fuzzer readme
Nikita Popov [Fri, 12 Jun 2020 07:50:52 +0000 (09:50 +0200)]
Update fuzzer readme

Drop --enable-json flag and make it more obvious that clang needs
to be used.

4 years agoMerge branch 'PHP-7.4'
Anatol Belski [Thu, 11 Jun 2020 11:23:35 +0000 (13:23 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  sqlite3: Fix possible use after free

4 years agosqlite3: Fix possible use after free
Anatol Belski [Thu, 11 Jun 2020 11:09:00 +0000 (13:09 +0200)]
sqlite3: Fix possible use after free

Exception should be thrown before the db handle is destroyed.
The backtrace excerpt

==26628== Invalid read of size 4
==26628==    at 0x53C49E3: sqlite3_errmsg (in /usr/lib64/libsqlite3.so.0.8.6)
==26628==    by 0x38C4E9: zim_sqlite3_open (sqlite3.c:142)
==26628==    by 0x8977BF: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:1618)
==26628==    by 0x8F801E: execute_ex (zend_vm_execute.h:53824)
==26628==    by 0x8FC0BB: zend_execute (zend_vm_execute.h:57920)
==26628==    by 0x828F54: zend_execute_scripts (zend.c:1672)
==26628==    by 0x793C2C: php_execute_script (main.c:2621)
==26628==    by 0x8FEA44: do_cli (php_cli.c:964)
==26628==    by 0x8FF9DC: main (php_cli.c:1359)

Signed-off-by: Anatol Belski <ab@php.net>
4 years agoUse cheaper variant of zend_hash_index_find()
Dmitry Stogov [Wed, 10 Jun 2020 22:34:55 +0000 (01:34 +0300)]
Use cheaper variant of zend_hash_index_find()

4 years agoFix #73529: session_decode() silently fails on wrong input
Christoph M. Becker [Wed, 10 Jun 2020 12:04:51 +0000 (14:04 +0200)]
Fix #73529: session_decode() silently fails on wrong input

The `php_serialize` decode function has to return `FAILURE`, if the
unserialization failed on anything but an empty string.

The `php` decode function has also to return `FAILURE`, if there is
trailing garbage in the string.

4 years agoMerge branch 'PHP-7.4'
Christoph M. Becker [Wed, 10 Jun 2020 14:45:08 +0000 (16:45 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Update NEWS wrt. bug 79681

4 years agoUpdate NEWS wrt. bug 79681
Christoph M. Becker [Wed, 10 Jun 2020 14:44:17 +0000 (16:44 +0200)]
Update NEWS wrt. bug 79681

4 years agoMerge branch 'PHP-7.4'
Christoph M. Becker [Wed, 10 Jun 2020 14:40:39 +0000 (16:40 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Fix #79681: mime_content_type/finfo returning incorrect mimetype

4 years agoFix #79681: mime_content_type/finfo returning incorrect mimetype
Christoph M. Becker [Tue, 9 Jun 2020 14:22:55 +0000 (16:22 +0200)]
Fix #79681: mime_content_type/finfo returning incorrect mimetype

We backport the respective fix for MP3s[1].

[1] <https://github.com/file/file/commit/5a55569a35eff686d4b7400b219d380f7c622890>

4 years agoMore efficient check for valid class name
Nikita Popov [Wed, 10 Jun 2020 12:50:35 +0000 (14:50 +0200)]
More efficient check for valid class name

Use a bitset of valid characters instead of strspn. This is both
more efficient and more compact.

4 years agoMerge branch 'PHP-7.4'
Nikita Popov [Wed, 10 Jun 2020 12:10:18 +0000 (14:10 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Explicitly start postgres on azure

4 years agoExplicitly start postgres on azure
Nikita Popov [Wed, 10 Jun 2020 11:04:14 +0000 (13:04 +0200)]
Explicitly start postgres on azure

Seems to be necessary now...

4 years agoMerge branch 'PHP-7.4'
Christoph M. Becker [Wed, 10 Jun 2020 10:12:47 +0000 (12:12 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Also support absolute Windows filenames

4 years agoAlso support absolute Windows filenames
Christoph M. Becker [Wed, 10 Jun 2020 09:49:14 +0000 (11:49 +0200)]
Also support absolute Windows filenames

The output normalization of bless_tests.php only detected absolute Unix
filenames; we extend this for absolute Windows filenames, regardless of
the platform we're running on (tests may have been run on Windows, but
bless_tests.php may be run from WSL or a Linux VM, for instance).

4 years agoFix bug #65006
Nikita Popov [Wed, 10 Jun 2020 08:25:50 +0000 (10:25 +0200)]
Fix bug #65006

The "callable name" may be the same for multiple distinct callables.
The code already worked around this for the case of instance methods,
but there are other cases in which callable names clash, such as
the use of self:: reported in the referenced bug.

Rather than trying to generate a unique name for callables, compare
the content of the alfi structures. This is less efficient if there
are many autoload functions, but autoload *registration* does not
need to be particularly efficient.

As a side-effect, this no longer permits unregistering non-callables.

4 years agoSimplify spl_autoload_perform() implementation
Nikita Popov [Wed, 10 Jun 2020 08:14:12 +0000 (10:14 +0200)]
Simplify spl_autoload_perform() implementation

And convert alfi.obj from zval to zend_object*.

4 years agoRemove called_scope inheritance in zend_call_method()
Nikita Popov [Wed, 10 Jun 2020 08:03:43 +0000 (10:03 +0200)]
Remove called_scope inheritance in zend_call_method()

Similar to 097043db2a0d113f89bd26c6f1d7a976d83951a8, but for the
zend_call_method() API. I don't think we ever use this for
static methods, but this logic shouldn't be there. If you want
to inherit the active LSB scope for some reason, do so explicitly.

4 years agoFix called scope assignment in autoloader
Nikita Popov [Wed, 10 Jun 2020 07:55:50 +0000 (09:55 +0200)]
Fix called scope assignment in autoloader

We should use the scope specified in the spl_autoload_register()
call, not whatever LSB scope just so happens to be active at the
time of the autoloader call.

4 years agoRemove autoload_running flag
Nikita Popov [Wed, 10 Jun 2020 07:41:58 +0000 (09:41 +0200)]
Remove autoload_running flag

This was only used to decide between a hash clean and a hash
destroyed in spl_autoload_remove(). But now that
spl_autoload_functions() no longer distinguishes between NULL and
an empty array here, there's really no need to try and destroy
the hashtable here.

4 years agoCleanup SPL autoload implementation
Nikita Popov [Tue, 9 Jun 2020 15:36:36 +0000 (17:36 +0200)]
Cleanup SPL autoload implementation

Replace EG(autoload_func) with a C level zend_autoload hook.
This avoids having to do one indirection through PHP function
calls. The need for EG(autoload_func) was a leftover from the
__autoload() implementation.

Additionally, drop special-casing of spl_autoload(), and instead
register it just like any other autoloading function. This fixes
bug #71236 as a side-effect.

Finally, change spl_autoload_functions() to always return an array.
The distinction between false and an empty array no longer makes
sense here.

Closes GH-5696.

4 years agoControl VCRT leak reporting via environment variable in debug builds
Christoph M. Becker [Wed, 20 May 2020 16:53:40 +0000 (18:53 +0200)]
Control VCRT leak reporting via environment variable in debug builds

Formerly, this had to be enabled by passing the configuration flag
`--enable-crt-debug`; now it can be enabled by setting the environment
variable `PHP_WIN32_DEBUG_HEAP`.  The advantage is that it is no longer
necessary to do separate builds, at the cost of a very minor
performance penalty during process startup.

4 years agoSetup RETURN counters for nested frames
Dmitry Stogov [Wed, 10 Jun 2020 05:10:27 +0000 (08:10 +0300)]
Setup RETURN counters for nested frames

4 years agoMerge branch 'PHP-7.4'
Xinchen Hui [Wed, 10 Jun 2020 03:21:13 +0000 (11:21 +0800)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Partial fixed bug #79649 (Altering disable_functions from module init corrupts memory)

4 years agoPartial fixed bug #79649 (Altering disable_functions from module init corrupts memory)
Xinchen Hui [Wed, 10 Jun 2020 03:16:42 +0000 (11:16 +0800)]
Partial fixed bug #79649 (Altering disable_functions from module init corrupts memory)

In module startup stage, we should not initiliaze
EG(modified_ini_directives) as it use zend MM, the zend MM will be
restart at the end of modules startup stage,

by say "partial", because this issue still exists if altering ZEND_USER
inis, we should add a zend_ini_deactive at the end of modules startup
stage, but it brings some new cost, and I think no one would do things
like that

4 years agoA helper to trace executed source lines
Dmitry Stogov [Tue, 9 Jun 2020 21:13:39 +0000 (00:13 +0300)]
A helper to trace executed source lines

4 years agoTracing JIT support for megamorphic calls
Dmitry Stogov [Tue, 9 Jun 2020 20:33:22 +0000 (23:33 +0300)]
Tracing JIT support for megamorphic calls

4 years agoAvoid unnecessary linking of Windows DLLs
Christoph M. Becker [Wed, 27 May 2020 14:59:54 +0000 (16:59 +0200)]
Avoid unnecessary linking of Windows DLLs

For snapshot builds (`--enable-snapshot-build`), after the build has
been completely finished, running `nmake` causes a lot of DLLs to be
rebuilt.  The problem is that the build folders OptimizerObj and
opcache_jit are dependencies of the main PHP DLL, but these folders do
not exists in the source tree, so nmake assumes it has to re-link the
main PHP DLL, and that makes several other DLLs stale.

We solve that by mirroring the folder structure of the respective
source folders.

4 years ago[ci skip] Fixed some minor typos in code comments
Javier Eguiluz [Tue, 9 Jun 2020 14:55:01 +0000 (16:55 +0200)]
[ci skip] Fixed some minor typos in code comments

4 years agoMerge branch 'PHP-7.4'
Christoph M. Becker [Tue, 9 Jun 2020 14:56:35 +0000 (16:56 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Fix possibly unsupported timercmp() usage

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Tue, 9 Jun 2020 14:54:04 +0000 (16:54 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix possibly unsupported timercmp() usage

4 years agoFix possibly unsupported timercmp() usage
Christoph M. Becker [Tue, 9 Jun 2020 08:12:32 +0000 (10:12 +0200)]
Fix possibly unsupported timercmp() usage

The `timercmp()` manpage[1] points out that some systems have a broken
implementation which does not support `>=`.  This is definitely the
case for the Windows SDK, which only supports `<` and `>`.

[1] <https://linux.die.net/man/3/timercmp>

4 years agoMerge branch 'PHP-7.4'
Christoph M. Becker [Tue, 9 Jun 2020 14:48:41 +0000 (16:48 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Fix #62890: default_socket_timeout=-1 causes connection to timeout

4 years agoRemove obsolete __lambda_func handling
Nikita Popov [Tue, 9 Jun 2020 14:46:58 +0000 (16:46 +0200)]
Remove obsolete __lambda_func handling

This is a leftover from create_function() support.

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Tue, 9 Jun 2020 14:46:32 +0000 (16:46 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #62890: default_socket_timeout=-1 causes connection to timeout

4 years agoFix #62890: default_socket_timeout=-1 causes connection to timeout
Christoph M. Becker [Tue, 9 Jun 2020 10:42:02 +0000 (12:42 +0200)]
Fix #62890: default_socket_timeout=-1 causes connection to timeout

While unencrypted connections ignore negative timeouts, SSL/TLS
connections did not special case that, and so always failed due to
timeout.

4 years agoMerge branch 'PHP-7.4'
Christoph M. Becker [Tue, 9 Jun 2020 14:40:56 +0000 (16:40 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  [ci skip] Update NEWS

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Tue, 9 Jun 2020 14:39:34 +0000 (16:39 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  [ci skip] Update NEWS

4 years ago[ci skip] Update NEWS
Christoph M. Becker [Tue, 9 Jun 2020 14:37:17 +0000 (16:37 +0200)]
[ci skip] Update NEWS

4 years agoBack up fake_scope in zend_call_function
Nikita Popov [Tue, 9 Jun 2020 14:30:46 +0000 (16:30 +0200)]
Back up fake_scope in zend_call_function

We regularly find new places where we forgot to reset fake_scope.
Instead of having to handle this for each caller of zend_call_function()
and similar APIs, handle it directly in zend_call_function().

4 years agoAdd zend_call_known_function() API family
Nikita Popov [Mon, 8 Jun 2020 15:10:24 +0000 (17:10 +0200)]
Add zend_call_known_function() API family

This adds the following APIs:

void zend_call_known_function(
    zend_function *fn, zend_object *object, zend_class_entry *called_scope,
    zval *retval_ptr, int param_count, zval *params);

void zend_call_known_instance_method(
    zend_function *fn, zend_object *object, zval *retval_ptr, int param_count, zval *params);
void zend_call_known_instance_method_with_0_params(
    zend_function *fn, zend_object *object, zval *retval_ptr);
void zend_call_known_instance_method_with_1_params(
    zend_function *fn, zend_object *object, zval *retval_ptr, zval *param);
void zend_call_known_instance_method_with_2_params(
    zend_function *fn, zend_object *object, zval *retval_ptr, zval *param1, zval *param2);

These are used to perform a call if you already have the
zend_function you want to call. zend_call_known_function()
is the base API, the rest are just really thin wrappers around
it for the common case of instance method calls.

Closes GH-5692.

4 years agoMerge branch 'PHP-7.4'
Nikita Popov [Tue, 9 Jun 2020 13:52:48 +0000 (15:52 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Fixed bug #79683

4 years agoFixed bug #79683
Nikita Popov [Tue, 9 Jun 2020 13:51:05 +0000 (15:51 +0200)]
Fixed bug #79683

Reset fake_scope during __toString() call.

I'll check if we can solve this more globally in master, by
resetting fake_scope in zend_call_function.

4 years agoTracing JIT support for real dynamic calls
Dmitry Stogov [Tue, 9 Jun 2020 11:02:02 +0000 (14:02 +0300)]
Tracing JIT support for real dynamic calls

4 years agoUse standard boolean type as zend_bool typedef
George Peter Banyard [Mon, 8 Jun 2020 10:40:29 +0000 (12:40 +0200)]
Use standard boolean type as zend_bool typedef

Closes GH-5624

4 years agoFix incorrect zend_bool usage for display_errors
George Peter Banyard [Mon, 8 Jun 2020 13:05:58 +0000 (15:05 +0200)]
Fix incorrect zend_bool usage for display_errors

4 years agoFix incorrect usage of zend_bool in Zend globals
George Peter Banyard [Mon, 8 Jun 2020 10:37:52 +0000 (12:37 +0200)]
Fix incorrect usage of zend_bool in Zend globals

4 years agoRemove some special-casing in zend_call_method()
Nikita Popov [Tue, 9 Jun 2020 08:09:48 +0000 (10:09 +0200)]
Remove some special-casing in zend_call_method()

Don't treat the !fn_proxy && !obj_ce case differently. There doesn't
seem to be any need for it, and it will result in subtly different
behavior (e.g. it will accept "Foo::bar" syntax, but break as soon
as you pass in an fn_proxy cache).

4 years agoFix some UNKNOWN default values
Máté Kocsis [Mon, 8 Jun 2020 09:10:56 +0000 (11:10 +0200)]
Fix some UNKNOWN default values

In ext/ffi, ext/intl, ext/mysqli, and ext/pcntl

4 years agoFix new test case for master
Christoph M. Becker [Tue, 9 Jun 2020 06:46:21 +0000 (08:46 +0200)]
Fix new test case for master

4 years agoFix #78750: configure assumes yacc and re2c work
Peter Kokot [Sun, 7 Jun 2020 19:53:39 +0000 (21:53 +0200)]
Fix #78750: configure assumes yacc and re2c work

Closes GH-5681

4 years agoAdd missing terminators in zend_language_parser.y
Ilija Tovilo [Mon, 8 Jun 2020 20:47:30 +0000 (22:47 +0200)]
Add missing terminators in zend_language_parser.y

Closes GH-5688

4 years agoMake zend_argument_error_variadic static
twosee [Mon, 8 Jun 2020 14:48:11 +0000 (22:48 +0800)]
Make zend_argument_error_variadic static

Closes GH-5687

4 years agoMerge branch 'PHP-7.4'
Christoph M. Becker [Mon, 8 Jun 2020 21:28:36 +0000 (23:28 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Fix #74267: segfault with streams and invalid data

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Mon, 8 Jun 2020 21:22:16 +0000 (23:22 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #74267: segfault with streams and invalid data

4 years agoFix #74267: segfault with streams and invalid data
Christoph M. Becker [Mon, 8 Jun 2020 21:19:43 +0000 (23:19 +0200)]
Fix #74267: segfault with streams and invalid data

If the current character is a line break character, it cannot be a tab
or space character, so we would always fail with an invalid sequence
error.  Obviously, these `scan_stat == 4` conditions are meant to be
exclusive.

Furthermore, if `in_pp == NULL || in_left_p == NULL` is true, we hit a
segfault if we are not returning right away.  Obviously, the additional
constraints don't make sense, so we remove them.

4 years agoAdd helper APIs for maybe-interned string creation
twosee [Mon, 8 Jun 2020 10:45:01 +0000 (18:45 +0800)]
Add helper APIs for maybe-interned string creation

Add ZVAL_CHAR/RETVAL_CHAR/RETURN_CHAR as a shortcut for using
ZVAL_INTERNED_STRING and ZSTR_CHAR.

Add zend_string_init_fast() as a helper for the empty string /
one char interned string / zend_string_init() pattern.

Also add corresponding ZVAL_STRINGL_FAST etc macros.

Closes GH-5684.

4 years agoOptimize out no-op `yield from` statements
Tyson Andre [Sun, 7 Jun 2020 17:17:40 +0000 (13:17 -0400)]
Optimize out no-op `yield from` statements

If the array is empty, then I'd expect that the generator is never left,
and that can be converted to a no-op and the return value would always be `null`.

Make `yield from [];` as efficient as `if (false) { yield null; }`
when opcache's sccp pass is enabled.

Closes GH-5679

4 years agoDon't allow variables as attribute name
Nikita Popov [Mon, 8 Jun 2020 12:34:04 +0000 (14:34 +0200)]
Don't allow variables as attribute name

Attributes require a static class name...

This fixes https://oss-fuzz.com/testcase-detail/6267052359942144.

4 years agoFix bug #77966: Cannot alias a method named "namespace"
Nikita Popov [Fri, 5 Jun 2020 14:55:20 +0000 (16:55 +0200)]
Fix bug #77966: Cannot alias a method named "namespace"

This is a bit tricky: In this cases we have "namespace as", which
means that we will only recognize "namespace" as an identifier when
the lookahead token is already at the "as". This means that
zend_lex_tstring picks up the wrong identifier.

We solve this by actually assigning the identifier as the semantic
value on the parser stack -- as in almost all cases we will not
actually need the identifier, this is just an (offset, size)
reference, not a copy of the string.

Additionally, we need to teach the lexer feedback mechanism used
by tokenizer TOKEN_PARSE mode to apply feedback to something
other than the very last token. To that purpose we pass through
the token text and check the tokens in reverse order to find the
right one.

Closes GH-5668.

4 years agoFix typo of IteratorAggregateImpl
Phil Davis [Mon, 8 Jun 2020 08:29:29 +0000 (14:14 +0545)]
Fix typo of IteratorAggregateImpl

Closes GH-5682.

4 years agoMerge branch 'PHP-7.4'
Nikita Popov [Mon, 8 Jun 2020 09:32:24 +0000 (11:32 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Fixed bug #79657

4 years agoFixed bug #79657
Nikita Popov [Mon, 8 Jun 2020 09:31:28 +0000 (11:31 +0200)]
Fixed bug #79657

Throwing an exception should count as an initialization for this
purpose.

4 years agoFixed incorrect zend_bool type usage
Dmitry Stogov [Mon, 8 Jun 2020 09:18:05 +0000 (12:18 +0300)]
Fixed incorrect zend_bool type usage

4 years agoConstify char * arguments of APIs
twosee [Sun, 7 Jun 2020 09:01:19 +0000 (17:01 +0800)]
Constify char * arguments of APIs

Closes GH-5676.

4 years agoMerge branch 'PHP-7.4'
Nikita Popov [Mon, 8 Jun 2020 08:36:01 +0000 (10:36 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Disable mysqlnd compression on msan build

4 years agoDisable mysqlnd compression on msan build
Nikita Popov [Mon, 8 Jun 2020 08:35:05 +0000 (10:35 +0200)]
Disable mysqlnd compression on msan build

This recently got enabled when detection was fixed. However,
we don't want this for msan builds, because our zlib is not
instrumented.

4 years agoFix leak in openssl_cms_read()
Nikita Popov [Mon, 8 Jun 2020 08:13:25 +0000 (10:13 +0200)]
Fix leak in openssl_cms_read()

4 years ago[skip ci] typo
Remi Collet [Mon, 8 Jun 2020 06:02:48 +0000 (08:02 +0200)]
[skip ci] typo

4 years agoDeprecate function aliases in oci8 extension.
Jens de Nies [Sun, 17 May 2020 21:48:01 +0000 (23:48 +0200)]
Deprecate function aliases in oci8 extension.

Closes GH-5589

4 years agoUpdate NEWS and UPGRADING for the OpenSSL ext CMS addition
Jakub Zelenka [Sun, 7 Jun 2020 20:11:09 +0000 (21:11 +0100)]
Update NEWS and UPGRADING for the OpenSSL ext CMS addition

4 years agoAdd support for Cryptographic Message Syntax (CMS)
Eliot Lear [Mon, 9 Mar 2020 15:01:20 +0000 (16:01 +0100)]
Add support for Cryptographic Message Syntax (CMS)

It add CMS (RFC 5652) support, which is an update to PKCS7.  The functions
are analogous BUT NOT IDENTICAL to openssl_pkcs7*.  In particular, support for
different encodings (PEM, DER, SMIME) is now available.

4 years agoAdd $filter parameter for ReflectionClass::(getConstants|getReflectionConstants)
Gabriel Caruso [Sat, 30 May 2020 22:17:31 +0000 (00:17 +0200)]
Add $filter parameter for ReflectionClass::(getConstants|getReflectionConstants)

This solves [#79628](https://bugs.php.net/79628).

Similar to `ReflectionClass::getMethods()` and `ReflectionClass::getProperties()`,
this new `$filter` argument allows the filtering of constants defined in a class by
their visibility.

For that, we create three new constants for `ReflectionClassConstant`:

  * `IS_PUBLIC`
  * `IS_PROTECTED`
  * `IS_PRIVATE`

Closes GH-5649.

4 years agoFix tests' description for `ReflectionClass::getConstant`
Gabriel Caruso [Sat, 30 May 2020 21:21:39 +0000 (23:21 +0200)]
Fix tests' description for `ReflectionClass::getConstant`

4 years agoFix expression warnings and break warnings
twosee [Sun, 7 Jun 2020 00:38:13 +0000 (08:38 +0800)]
Fix expression warnings and break warnings

Close GH-5675.

4 years agoMerge branch 'PHP-7.4'
Nikita Popov [Sun, 7 Jun 2020 08:38:50 +0000 (10:38 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Allow defining of uname value for reproducible builds

4 years agoAllow defining of uname value for reproducible builds
Jelle van der Waa [Fri, 5 Jun 2020 20:50:58 +0000 (22:50 +0200)]
Allow defining of uname value for reproducible builds

Extend configure.ac to accept PHP_UNAME as env variable to set the value of the
PHP_UNAME define in a reproducible manner. This allows distributions to set a
fixed value for php_uname and keep the default behaviour if PHP_UNAME is not
set.

Motivation: https://reproducible-builds.org/

Closes GH-5671.

4 years agoRemove duplicate zend_try
twosee [Sat, 6 Jun 2020 10:12:05 +0000 (18:12 +0800)]
Remove duplicate zend_try

Closes GH-5672.

4 years agoFix warning of strict-prototypes
twosee [Sat, 6 Jun 2020 12:13:38 +0000 (20:13 +0800)]
Fix warning of strict-prototypes

Closes GH-5673.

4 years agoFix free of uninitialized memory in attributes
Nikita Popov [Sun, 7 Jun 2020 08:24:03 +0000 (10:24 +0200)]
Fix free of uninitialized memory in attributes

Fixes OSS-Fuzz #23140.

4 years agomove comment
Remi Collet [Sun, 7 Jun 2020 06:16:50 +0000 (08:16 +0200)]
move comment

4 years agoFixed bug #79678 Build fails due to undeclared ZIP_RDONLY
Remi Collet [Sun, 7 Jun 2020 05:53:14 +0000 (07:53 +0200)]
Fixed bug #79678 Build fails due to undeclared ZIP_RDONLY

4 years agoFix invalid usage of zend_bool in DOM extension
George Peter Banyard [Sat, 6 Jun 2020 13:02:17 +0000 (15:02 +0200)]
Fix invalid usage of zend_bool in DOM extension

4 years agoFix BC break of zend_throw_exception
twosee [Sat, 6 Jun 2020 06:47:39 +0000 (14:47 +0800)]
Fix BC break of zend_throw_exception

This also fixes a SegFault

Closes GH-5670

4 years agoAdd tests to check mismatching function signatures
Máté Kocsis [Fri, 5 Jun 2020 12:40:40 +0000 (14:40 +0200)]
Add tests to check mismatching function signatures

Closes GH-5666

4 years agoopenssl: Fix openssl_pkcs12_export_to_file extracerts test
Nicolas Frandeboeuf [Fri, 5 Jun 2020 10:23:36 +0000 (12:23 +0200)]
openssl: Fix openssl_pkcs12_export_to_file extracerts test

Same as https://github.com/php/php-src/pull/2681/files but for openssl_pkcs12_export_to_file

Closes GH-5665

4 years agoRefactor IntlBreakIterator::next() handling
George Peter Banyard [Fri, 5 Jun 2020 17:01:13 +0000 (19:01 +0200)]
Refactor IntlBreakIterator::next() handling

4 years agoConvert code path which should never happen to assertion
George Peter Banyard [Fri, 5 Jun 2020 16:00:56 +0000 (18:00 +0200)]
Convert code path which should never happen to assertion

4 years agoencode param is optional
Remi Collet [Fri, 5 Jun 2020 15:08:21 +0000 (17:08 +0200)]
encode param is optional

4 years agoMerge branch 'PHP-7.4'
Nikita Popov [Fri, 5 Jun 2020 14:27:09 +0000 (16:27 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Remove unnecessary "poo" rmdirs

4 years agoRemove unnecessary "poo" rmdirs
Nikita Popov [Fri, 5 Jun 2020 14:26:09 +0000 (16:26 +0200)]
Remove unnecessary "poo" rmdirs

"poo" was only used in the opendir_edgecases test, but rmdir'ed
in some other tests as well.

I've also taken the liberty of renaming this directory...

4 years agobump zip version
Remi Collet [Fri, 5 Jun 2020 14:23:43 +0000 (16:23 +0200)]
bump zip version

4 years agoImplement "Constructor Promotion" RFC
Nikita Popov [Tue, 24 Mar 2020 12:18:28 +0000 (13:18 +0100)]
Implement "Constructor Promotion" RFC

RFC: https://wiki.php.net/rfc/constructor_promotion

Closes GH-5291.

4 years agomicro-optimization
Dmitry Stogov [Fri, 5 Jun 2020 11:20:39 +0000 (14:20 +0300)]
micro-optimization

4 years agoDrop hard-coded /W3 default in favor of custom CFLAGS
Christoph M. Becker [Wed, 27 May 2020 10:01:16 +0000 (12:01 +0200)]
Drop hard-coded /W3 default in favor of custom CFLAGS

Building with `/W3` shows an awful lot of warnings on Windows, so it's
really hard to spot the more important ones.  Since it is not possible
to override the hard-coded `/W3`, we drop it altogether, so MSVC uses
the default `/W1`.  Users are encouraged to increase the warning level
via the environment variable `CFLAGS` before doing configure.

We also enable `/WX` (treat warnings as errors) for AppVeyor CI, using
`/W1` for now, since otherwise the build would fail.

4 years agoFix MSVC level 1 (severe) warnings
Christoph M. Becker [Wed, 27 May 2020 07:58:10 +0000 (09:58 +0200)]
Fix MSVC level 1 (severe) warnings

We fix (hopefully) all instances of:

* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4024>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4028>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4047>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4087>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4090>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4312>

`zend_llist_add_element()` and `zend_llist_prepend_element()` now
explicitly expect a *const* pointer.

We use the macro `ZEND_VOIDP()` instead of a `(void*)` cast to suppress
C4090; this should prevent accidential removal of the cast by
clarifying the intention, and makes it easier to remove the casts if
the issue[1] will be resolved sometime.

[1] <https://developercommunity.visualstudio.com/content/problem/390711/c-compiler-incorrect-propagation-of-const-qualifie.html>

4 years agoMerge branch 'PHP-7.4'
Nikita Popov [Fri, 5 Jun 2020 08:52:07 +0000 (10:52 +0200)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Update intl test suite for ICU 67.1

4 years agoUpdate intl test suite for ICU 67.1
Christoph M. Becker [Fri, 24 Apr 2020 08:43:42 +0000 (10:43 +0200)]
Update intl test suite for ICU 67.1

Cherry-picked from c915c601710e2a44e6c7f89fcb12b8047c968108.

4 years agoFree attribute validators on shutdown
Nikita Popov [Fri, 5 Jun 2020 08:36:35 +0000 (10:36 +0200)]
Free attribute validators on shutdown