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

55504 Commits

Author SHA1 Message Date
Nikita Popov
315ea609da Remove restriction on method call inlining
In PHP 8, we are guaranteed that $this exists, so we no longer have
to forbid this case.
2020-06-29 09:54:31 +02:00
Nikita Popov
bc62acf874 Merge branch 'PHP-7.4'
* PHP-7.4:
  Don't inline static call to instance method
2020-06-29 09:53:09 +02:00
Nikita Popov
fabcd9f14e Don't inline static call to instance method
Fixes the failure in bug79740.phpt with opcache.
2020-06-29 09:52:37 +02:00
George Peter Banyard
562ceae7bc Drop non-well formed numeric strings from math function tests 2020-06-28 19:32:11 +02:00
George Peter Banyard
892b32d839 Drop non-well numeric string in Intl test 2020-06-28 19:30:07 +02:00
George Peter Banyard
a9625f8b35 Drop non-well formed numeric strings in array function tests 2020-06-28 19:29:37 +02:00
George Peter Banyard
76643cd4f3 Drop non-well formed numeric strings in strings function tests 2020-06-28 19:29:14 +02:00
Nikita Popov
f930978b70 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79741
2020-06-26 12:29:43 +02:00
Nikita Popov
978cdb736a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79741
2020-06-26 12:29:23 +02:00
Nikita Popov
43cd3f6814 Fixed bug #79741 2020-06-26 12:28:39 +02:00
Nikita Popov
1314ccbf8c Cache __unserialize() instead of unserialize()
We should use these cache slots for the new object serialization
mechanism rather than the old one.
2020-06-26 10:54:40 +02:00
Dmitry Stogov
9617c2a2f6 Use cheaper zend_hash_find_ex() to handle IS_CONST index 2020-06-26 11:18:04 +03:00
Nikita Popov
bcd7352b0c Fix uninitialized reads in min/max
We need to use the unstable comparison function here, the fallback
order is not initialized in this context.
2020-06-26 09:36:17 +02:00
Ayesh Karunaratne
d114812faf [ci skip] Various typo fixes in stub comments and CHANGES file 2020-06-25 23:32:40 +02:00
Dmitry Stogov
7e940823d5 Fixed incorrect type guard 2020-06-25 21:59:48 +03:00
Dmitry Stogov
4e7cac810f Move exception check to cold path. 2020-06-25 20:11:23 +03:00
Dmitry Stogov
037bfabd75 Optimization for +/- int(0) 2020-06-25 19:09:54 +03:00
Dmitry Stogov
50af4de0fe Improve tracing JIT for FETCH_THIS + FETCH_OBJ_* 2020-06-25 17:33:53 +03:00
Nikita Popov
785497c8ba Fix leaks in Phar::webPhar() 2020-06-25 15:42:56 +02:00
Nikita Popov
c9bc7dd110 Don't throw warning if exception thrown during dom validation 2020-06-25 15:24:35 +02:00
Nikita Popov
049467d365 Avoid warning on exception in xsl ext 2020-06-25 15:07:38 +02:00
Dmitry Stogov
94b637de5b Avoid $this check 2020-06-25 14:08:21 +03:00
Dmitry Stogov
1434983ad1 Cheaper exception checks 2020-06-25 13:23:43 +03:00
Nikita Popov
47cf18ba4e Don't include trailing newline in comment token
Don't include a trailing newline in T_COMMENT tokens, instead leave
it for a following T_WHITESPACE token. The newline does not belong
to the comment logically, and this makes for an ugly special case,
as other tokens do not include trailing newlines.

Whitespace-sensitive tooling will want to either forward or backward
emulate this change.

Closes GH-5182.
2020-06-25 11:25:22 +02:00
Nikita Popov
e12b9df05d Make sorting stable
Make user-exposed sorts stable, by storing the position of elements
in the original array, and using those positions as a fallback
comparison criterion. The base sort is still hybrid q/insert.

The use of true/false comparison functions is deprecated (but still
supported) and should be replaced by -1/0/1 comparison functions,
driven by the <=> operator.

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

Closes GH-5236.
2020-06-25 10:49:34 +02:00
Nikita Popov
f37138d2c5 Don't use iterator_funcs_ptr if it is null
This avoids ubsan warnings. Alternatively we could always initialize
iterator_funcs_ptr for aggregates, instead of doing so only for
non-internal ones.
2020-06-25 10:30:40 +02:00
Alex Dowad
47fae8425f Remove useless prototype for spl_heap_get_iterator 2020-06-24 22:29:07 +02:00
Alex Dowad
c4f716a20d Fix {{{ comment to match function name for php_replace_controlchars_ex 2020-06-24 22:26:00 +02:00
Nikita Popov
ff19ec2df3 Introduce InternalIterator
Userland classes that implement Traversable must do so either
through Iterator or IteratorAggregate. The same requirement does
not exist for internal classes: They can implement the internal
get_iterator mechanism, without exposing either the Iterator or
IteratorAggregate APIs. This makes them usable in get_iterator(),
but incompatible with any Iterator based APIs.

A lot of internal classes do this, because exposing the userland
APIs is simply a lot of work. This patch alleviates this issue by
providing a generic InternalIterator class, which acts as an
adapater between get_iterator and Iterator, and can be easily
used by many internal classes. At the same time, we extend the
requirement that Traversable implies Iterator or IteratorAggregate
to internal classes as well.

Closes GH-5216.
2020-06-24 15:31:41 +02:00
Nikita Popov
4730b06f1d Make SimpleXMLElement a RecursiveIterator
Context: https://externals.io/message/108789

This essentially moves the functionality of SimpleXMLIterator into
SimpleXMLElement, and makes SimpleXMLIterator a no-op extension.

Ideally SimpleXMLElement would be an IteratorAggregate, whose
getIterator() method returns SimpleXMLIterator. However, because
SimpleXMLIterator extends SimpleXMLElement (and code depends on
this in non-trivial ways), this is not possible.

The only way to not keep SimpleXMLElement as a magic Traversable
(that implements neither Iterator nor IteratorAggregate) is to
move the SimpleXMLIterator functionality into it.

Closes GH-5234.
2020-06-24 15:09:21 +02:00
Máté Kocsis
bcb9658b87 Add the ZEND_ACC_NO_DYNAMIC_PROPERTIES flag to Shmop 2020-06-24 14:56:06 +02:00
Christoph M. Becker
18f58080dc Convert shmop resources to opaque objects
We make `shmop_close()` a NOP, and deprecate the function right away;
detaching from SHM now happens when the wrapper object is freed.
2020-06-24 13:59:29 +02:00
Alex Dowad
19d3e29bf5 Clean house in cryptographic hashing code
- Remove dead code from php_crypt_r.c

  This code has been commented out since the file was added in 2008. It's safe to say
  that no-one is ever going to use it.

- Fix typo in comment in php_crypt_r.c

- Remove redundant Windows-only implementation of php_md5_crypt_r

  There is a portable implementation in the same file, which is selected if not
  building for Windows. But why should Windows have its own special implementation
  of this function at all? There doesn't seem to be any good reason.

  Better to use the portable implementation on all platforms.

- Don't define useless __CONST macro in php_crypt_r.h

  This preprocessor macro is not used anywhere.

- Add comment on functions for encoding data as Base64

- Remove dead code from crypt_blowfish.h

- Remove unneeded junk comments from crypt_freesec.c

- Remove dead code from crypt_blowfish.c

  This function has been commented out since 2011.
2020-06-24 13:40:27 +02:00
Alex Dowad
e94afec700 Fix typos in test cases for crypt_sha{256,512} 2020-06-24 13:37:26 +02:00
Máté Kocsis
b5c7a83dca Remove unnecessary PHPDoc-alike blocks from tests
Closes GH-5759
2020-06-24 13:13:44 +02:00
Nikita Popov
187d7f05c2 Fix potential use-after-scope if crypt_r is used 2020-06-24 13:07:00 +02:00
Nikita Popov
d579b10c84 Remove deprecated DES fallback in crypt() 2020-06-24 12:57:04 +02:00
Nikita Popov
8a8c8d4d6a Enforce min/max rounds in sha256/sha512 crypt
This brings our implementation in line with glibc behavior.
2020-06-24 12:41:56 +02:00
Nikita Popov
4c4af2b2e1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Handle *0 / *1 more consistently
2020-06-24 12:22:44 +02:00
Nikita Popov
565baf05c0 Handle *0 / *1 more consistently
Avoid throwing a DES salt deprecation warning if the libc crypt
implementation is used.
2020-06-24 12:22:07 +02:00
Nikita Popov
7d05bc8630 Fix crypt_r detection
And force use of our own php_crypt_r implementation to keep
previous behavior despite that.
2020-06-24 12:09:49 +02:00
Christoph M. Becker
38177dcb42 Properly initialize displaysize
From Microsoft's `SQLColAttribute()` documentation[1]:

| Please note that some drivers may only write the lower 32-bit or
| 16-bit of a buffer and leave the higher-order bit unchanged.
| Therefore, applications should initialize the value to 0 before
| calling this function.

[1] <https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolattribute-function>
2020-06-24 12:07:58 +02:00
Máté Kocsis
16fe64d3ed Add ZEND_ACC_NO_DYNAMIC_PROPERTIES flag to SysvMessageQueue 2020-06-24 12:04:10 +02:00
Nikita Popov
653e4ea1c5 Add flag to forbid dynamic property creation on internal classes
While performing resource -> object migrations, we're adding
defensive classes that are final, non-serializable and non-clonable
(unless they are, of course). This path adds a ZEND_ACC_NO_DYNAMIC_PROPERTIES
flag, that also forbids the creation of dynamic properties on these objects.
This is a subset of #3931 and targeted at internal usage only
(though may be extended to userland at some point in the future).

It's already possible to achieve this (what the removed
WeakRef/WeakMap code does), but there's some caveats: First, this
simple approach is only possible if the class has no declared
properties, otherwise it's necessary to special-case those
properties. Second, it's easy to make it overly strict, e.g. by
forbidding isset($obj->prop) as well. And finally, it requires a
lot of boilerplate code for each class.

Closes GH-5572.
2020-06-24 11:52:36 +02:00
Christoph M. Becker
2a28589c7d Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix potential environment variable deadlock
2020-06-24 11:44:47 +02:00
Christoph M. Becker
32257ac17f Fix potential environment variable deadlock
We have to unlock the environment before bailing out.
2020-06-24 11:44:07 +02:00
Christoph M. Becker
cbce0cbacb Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #69804: ::getStaticPropertyValue() throws on protected props
2020-06-24 11:19:17 +02:00
Christoph M. Becker
26aefb750a Fix #69804: ::getStaticPropertyValue() throws on protected props
`ReflectionClass` allows reading of the values of private and protected
constants, and also to get private and protected static methods.
Therefore getting the values of private and protected static properties
is also permissible, especially since `::getStaticProperties()` already
allows to do so.

We also allow ::setStaticPropertyValue() to modify private and
protected properties, because otherwise this method is useless, as
modifying public properties can be done directly.
2020-06-24 11:17:36 +02:00
Nikita Popov
d071ab1928 Fix verify arg jit for references 2020-06-24 10:47:37 +02:00
Nikita Popov
c008fde961 Skip two curl tests under asan
These tests leak with the curl version on ubuntu 20.04. This should
be fixed when we switch exit to use an exception.
2020-06-24 10:13:25 +02:00