1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 07:28:09 +02:00
Commit Graph

55316 Commits

Author SHA1 Message Date
Dmitry Stogov e9f295ac84 Tracing JIT support for megamorphic calls 2020-06-09 23:33:22 +03:00
Christoph M. Becker 4edce91fae 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.
2020-06-09 18:37:37 +02:00
Javier Eguiluz 066a378316 [ci skip] Fixed some minor typos in code comments 2020-06-09 17:17:55 +02:00
Christoph M. Becker 4b76a2ddb3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #62890: default_socket_timeout=-1 causes connection to timeout
2020-06-09 16:48:41 +02:00
Nikita Popov 3b8d26accf Remove obsolete __lambda_func handling
This is a leftover from create_function() support.
2020-06-09 16:47:40 +02:00
Christoph M. Becker 85657b486f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #62890: default_socket_timeout=-1 causes connection to timeout
2020-06-09 16:47:00 +02:00
Christoph M. Becker eadd980706 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.
2020-06-09 16:45:34 +02:00
Nikita Popov 257dbb0450 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.
2020-06-09 16:21:54 +02:00
Nikita Popov bcada03f48 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79683
2020-06-09 15:52:48 +02:00
Nikita Popov 2447fd9f84 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.
2020-06-09 15:51:05 +02:00
Dmitry Stogov 797c1c5088 Tracing JIT support for real dynamic calls 2020-06-09 14:02:02 +03:00
Máté Kocsis 596561009c Fix some UNKNOWN default values
In ext/ffi, ext/intl, ext/mysqli, and ext/pcntl
2020-06-09 09:46:51 +02:00
Christoph M. Becker cadcefc956 Fix new test case for master 2020-06-09 08:50:09 +02:00
Christoph M. Becker 383a9f46ad Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #74267: segfault with streams and invalid data
2020-06-08 23:28:36 +02:00
Christoph M. Becker ee4683cf28 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #74267: segfault with streams and invalid data
2020-06-08 23:22:49 +02:00
Christoph M. Becker 12c59f6660 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.
2020-06-08 23:19:43 +02:00
twosee 83a77015ad 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.
2020-06-08 15:31:52 +02:00
Tyson Andre 543684e796 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
2020-06-08 09:17:13 -04:00
Nikita Popov b03cafd19c 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.
2020-06-08 12:55:14 +02:00
Phil Davis 08518b18b2 Fix typo of IteratorAggregateImpl
Closes GH-5682.
2020-06-08 12:28:15 +02:00
Dmitry Stogov 13909e5555 Fixed incorrect zend_bool type usage 2020-06-08 12:18:05 +03:00
twosee 88355dd338 Constify char * arguments of APIs
Closes GH-5676.
2020-06-08 10:38:45 +02:00
Nikita Popov 57e17e58a5 Fix leak in openssl_cms_read() 2020-06-08 10:13:25 +02:00
Remi Collet cd3f42f17e [skip ci] typo 2020-06-08 08:02:48 +02:00
Jens de Nies 45475c2e21 Deprecate function aliases in oci8 extension.
Closes GH-5589
2020-06-08 00:23:38 +02:00
Eliot Lear 8583b8a9bf 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.
2020-06-07 16:58:34 +01:00
Gabriel Caruso 7439941d55 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.
2020-06-07 15:57:48 +02:00
Gabriel Caruso 84492f5b50 Fix tests' description for ReflectionClass::getConstant 2020-06-07 15:46:39 +02:00
twosee 7d6a0ba808 Fix expression warnings and break warnings
Close GH-5675.
2020-06-07 10:41:11 +02:00
twosee 1b85e749c7 Fix warning of strict-prototypes
Closes GH-5673.
2020-06-07 10:36:50 +02:00
Remi Collet 06ff0e8721 move comment 2020-06-07 08:16:50 +02:00
Remi Collet a3bfd4a108 Fixed bug #79678 Build fails due to undeclared ZIP_RDONLY 2020-06-07 07:53:26 +02:00
George Peter Banyard 706d4f3559 Fix invalid usage of zend_bool in DOM extension 2020-06-06 17:19:00 +02:00
Máté Kocsis aa9b0ccda8 Add tests to check mismatching function signatures
Closes GH-5666
2020-06-06 09:23:34 +02:00
Nicolas Frandeboeuf 170d63ec62 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
2020-06-05 22:28:01 +02:00
George Peter Banyard 4c6ecc820b Refactor IntlBreakIterator::next() handling 2020-06-05 22:16:33 +02:00
George Peter Banyard 7af0466044 Convert code path which should never happen to assertion 2020-06-05 22:11:06 +02:00
Remi Collet eae3bda9e3 encode param is optional 2020-06-05 17:10:12 +02:00
Nikita Popov 8d2c7efbc0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove unnecessary "poo" rmdirs
2020-06-05 16:27:09 +02:00
Nikita Popov 4902b1c554 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...
2020-06-05 16:26:09 +02:00
Remi Collet a838cb5e11 bump zip version 2020-06-05 16:23:43 +02:00
Nikita Popov 064b464448 Implement "Constructor Promotion" RFC
RFC: https://wiki.php.net/rfc/constructor_promotion

Closes GH-5291.
2020-06-05 15:15:51 +02:00
Christoph M. Becker 5a04796f76 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>
2020-06-05 11:17:05 +02:00
Christoph M. Becker 46d2a981dd Update intl test suite for ICU 67.1
Cherry-picked from c915c60171.
2020-06-05 10:51:51 +02:00
Nikita Popov 8a7756c1b7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Respect --program-prefix/suffix when installing phar
2020-06-05 10:10:52 +02:00
Nathan Porter ca7dcb88f3 Respect --program-prefix/suffix when installing phar
Currently ./configure --enable-phar --program-suffix=7.4 will
result in binaries named php7.4 and phar but should instead
result in php7.4 and phar7.4

Closes GH-5650.
2020-06-05 10:10:40 +02:00
Nikita Popov 975acfe71e Pass zend_string message to zend_error_cb
This makes the zend_error_cb API simpler, and avoid formatting
the same message in multiple places.

It should be noted that the passed zend_string is always
non-persistent, so if you want to store it persistently somewhere,
you may still need to duplicate it.

The last_error_message is cleared a bit more aggressive, to make
sure it doesn't hang around across allocator life-cycles.

Closes GH-5639.
2020-06-05 09:54:02 +02:00
Dmitry Stogov bc37fc57e5 Avoid useless "mov" 2020-06-05 00:05:12 +03:00
George Peter Banyard 97757e759d Fix weird zend_bool usage in Intl Calendar::roll() method
This code really needs to be review as it's convoluted for no good reason.
2020-06-04 22:56:10 +02:00
Matthias Dötsch 957a0f6a69 in_array() avoid internal property access as we have the arrlen already
Closes GH-5662
2020-06-04 22:55:06 +02:00