Commit Graph
55936 Commits
Author SHA1 Message Date
Nikita Popov 300d108a0e Relax precision in atan test 2020-08-04 16:12:40 +02:00
Nikita Popov feba69ce2d Relax precision in hypot test 2020-08-04 16:12:33 +02:00
David Carlier 362194165a Fix opcache JIT on NetBSD with PaX
When PaX mprotect active, opcache JIT test fail as it needs
the PROT_MPROTECT macro to be able to allow further permission
promotion with mprotect.

Closes GH-5929.
2020-08-04 10:34:31 +02:00
Benjamin Eberlei 53ef244923 Add opcache.jit=tracing|function values, make on/yes/true synonym for tracing. 2020-08-04 10:15:22 +02:00
Máté Kocsis ae34a6539f Fix Socket related tests on Windows 2020-08-04 09:25:41 +02:00
Máté Kocsis 2d32b633b2 Cleanup snmp after resource to object migration 2020-08-04 09:14:12 +02:00
Máté Kocsis 040b5e727a Fix posix test 2020-08-04 09:11:55 +02:00
Christoph M. Becker bfdbb90d30 Fix Windows build 2020-08-04 00:10:29 +02:00
Máté Kocsis 77172c220a Convert resources to objects in ext/sockets
Closes GH-5900.
2020-08-03 23:26:38 +02:00
Dik Takken e0fa48f69d Deprecate libxml_disable_entity_loader()
This method was used to protect code against XXE processing attacks.
Since PHP now requires libxml >= 2.9.0 external entity loading no longer
needs to be disabled to prevent these attacks. It is disabled by default.
Also, the method has an unwanted side effect that causes a lot of
confusion: Parsing XML data from resources like files is no longer possible.

Closes GH-5867.
2020-08-03 21:53:29 +02:00
Dik Takken 691a09f291 Bump libxml version requirement 2.7.6 => 2.9.0
Since libxml version 2.9.0 external entity loading is disabled by default.
Bumping the version requirement means that XML processing in PHP is no
longer vulnerable to XXE processing attacks by default.
2020-08-03 21:51:10 +02:00
Máté Kocsis 4c89ed61fb Promote warnings to exceptions in ext/gettext, ext/sysvmsg and ext/xml
Closes GH-5926
2020-08-03 20:09:28 +02:00
Tyson Andre 0c238ede01 [RFC] Only unserialize Phar metadata when getMetadata() is called
In other words, don't automatically unserialize when the magic
phar:// stream wrappers are used.
RFC: https://wiki.php.net/rfc/phar_stop_autoloading_metadata

Also, change the signature from `getMetadata()`
to `getMetadata(array $unserialize_options = [])`.
Start throwing earlier if setMetadata() is called and serialization threw.

See https://externals.io/message/110856 and
https://bugs.php.net/bug.php?id=76774

This was refactored to add a phar_metadata_tracker for the following reasons:
- The way to properly copy a zval was previously implicit and undocumented
  (e.g. is it a pointer to a raw string or an actual value)
- Avoid unnecessary serialization and unserialization in the most common case
- If a metadata value is serialized once while saving a new/modified phar file,
  this allows reusing the same serialized string.
- Have as few ways to copy/clone/lazily parse metadata (etc.) as possible,
  so that code changes can be limited to only a few places in the future.
- Performance is hopefully not a concern - copying a string should be faster
  than unserializing a value, and metadata should be rare in most cases.

Remove unnecessary skip in a test(Compression's unused)

Add additional assertions about usage of persistent phars

Improve robustness of `Phar*->setMetadata()`

- Add sanity checks for edge cases freeing metadata, when destructors
  or serializers modify the phar recursively.
- Typical use cases of php have phar.readonly=1 and would not be affected.

Closes GH-5855
2020-08-03 13:28:51 -04:00
Rowan Tommins f9f769d4b9 Make http stream wrapper advertise HTTP/1.1 by default
In practice, we always act as an HTTP/1.1 client, for compatibility
with servers which ignore protocol version. Sending the version in
the request will avoid problems with servers which don't ignore it.

HTTP/1.0 can still be forced using a stream context option.

Closes GH-5899.
2020-08-03 16:30:09 +02:00
Levi Morrison 9b975fe98e Merge branch 'levim/assert-throw'
This changes assert.exception to default to 1, or on by default.
Closes GH-5925.
2020-08-03 08:04:48 -06:00
Santiago M. Mola 65713aaddd Fix #79923: fix socket_set_option_bindtodevice test
Closes GH-5924.
2020-08-03 15:03:07 +02:00
Nikita Popov 501db98e57 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #79924
2020-08-03 14:56:57 +02:00
Nikita Popov 8b4da1774f Fix bug #79924
Move functions that are only used with ipv6 support under
HAVE_IPV6 checks.
2020-08-03 14:56:27 +02:00
Nikita Popov c48b745f00 Promote "undefined array key" notice to warning
This implements the last remaining part of the
https://wiki.php.net/rfc/engine_warnings RFC.

Closes GH-5927.
2020-08-03 14:40:50 +02:00
Christoph M. Becker b9171d8a93 Fix fix for bug #79877 for PHP 8
PHP 8 is supposed to throw here.
2020-08-03 12:01:56 +02:00
Nikita Popov b891adea8d Don't suppress notices in rfc1867 tests
The references notices in debug builds don't seem to be present
anymore.
2020-08-03 11:58:59 +02:00
Nikita Popov 7a4b594c6f Convert SPL illegal offset type into TypeError
Make this consistent with the corresponding engine behavior.
Also adjust the messages to match.
2020-08-03 11:17:49 +02:00
Gregor Harlan a6e3ce4fd6 datetime: new format "p", same as "P" but returning "Z" for UTC 2020-08-03 10:44:48 +02:00
Christoph M. Becker 05c5c93705 Fix #79877: getimagesize function silently truncates after a null byte
We have to check for NUL bytes if `getimagesize()` has been called.
2020-08-03 01:10:24 -07:00
Christoph M. Becker 775385df0e Fix #79797: Use of freed hash key in the phar_parse_zipfile function
We must not use heap memory after we freed it.
2020-08-03 01:10:22 -07:00
Christoph M. Becker 4d2560dd6a Fix #79877: getimagesize function silently truncates after a null byte
We have to check for NUL bytes if `getimagesize()` has been called.
2020-08-03 01:09:44 -07:00
Christoph M. Becker 9c3171f019 Fix #79797: Use of freed hash key in the phar_parse_zipfile function
We must not use heap memory after we freed it.
2020-08-03 01:09:44 -07:00
Christoph M. Becker 24495ba778 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Enable libxml entity loader test case on Windows
2020-08-03 09:15:50 +02:00
Christoph M. Becker d4b32e82c8 Enable libxml entity loader test case on Windows 2020-08-03 09:13:30 +02:00
Derick Rethans 90434d7fe3 Fixed bug #60302: DateTime::createFromFormat should new static(), not new self()
Also fixes similar issues for DateTimeImmutable::createFromFormat,
DateTime::createFromImmmutable, DateTime::createFromInterface,
DateTimeImmutable::createFromMutable, and
DateTimeImmutable::createFromInterface.
2020-08-03 00:43:41 +01:00
Máté Kocsis 6b7e2f0d15 Fix stub hash of ext/ldap 2020-08-03 01:06:21 +02:00
Máté Kocsis 79981a394e Add a bunch of missing argument types to stubs 2020-08-03 00:45:51 +02:00
Máté Kocsis 6ba24e9615 Improve a few parameter names in ext/spl
Use the same names which are used by zend functions.
2020-08-03 00:45:12 +02:00
Máté Kocsis 156c1806db Convert the $ttl parameter of ldap_exop_refresh() to int 2020-08-03 00:38:59 +02:00
Levi Morrison 853eb8373f Default assert.exception to 1 2020-08-02 13:39:35 -06:00
Gabriel Caruso e3d06fc79d Ensure correct signatures for magic methods 2020-08-02 01:29:56 +02:00
Máté Kocsis bdacd2ae8f Add a few missing types to stubs 2020-08-01 23:55:08 +02:00
Máté KocsisandNikita Popov 9f44eca6b6 Convert resources to objects in ext/openssl
Closes GH-5860

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-08-01 22:47:20 +02:00
Tyson Andre 97f10fc341 Allow overriding completion in auto_prepend_file
Currently, it's possible to override `php -a`s completion
functionality to provide an alternative to the C implementation,
with `readline_completion_function()`.

However, that surprisingly gets overridden when called from
`auto_prepend_file`, because those scripts get run before the interactive shell
is started. I believe that not overriding it would be more consistent
with what happens when you override the completion function **after** the
interactive shell.

CLI is the only built-in API that uses this (See discussion in GH-5872).
I believe MINIT and RINIT will only run once when invoked with `php -a`.

Add documentation about the architecture of how php uses readline/libedit

Closes GH-5872
2020-08-01 11:39:08 -04:00
Máté Kocsis ec22e5aa38 Get rid of empty function entries
Closes GH-5917
2020-08-01 10:07:05 +02:00
Nikita Popov d92229d8c7 Implement named parameters
From an engine perspective, named parameters mainly add three
concepts:

 * The SEND_* opcodes now accept a CONST op2, which is the
   argument name. For now, it is looked up by linear scan and
   runtime cached.
 * This may leave UNDEF arguments on the stack. To avoid having
   to deal with them in other places, a CHECK_UNDEF_ARGS opcode
   is used to either replace them with defaults, or error.
 * For variadic functions, EX(extra_named_params) are collected
   and need to be freed based on ZEND_CALL_HAS_EXTRA_NAMED_PARAMS.

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

Closes GH-5357.
2020-07-31 15:53:36 +02:00
George Peter Banyard 9a71d47d73 Throw ValueError on empty tag in enchant_broker_request_dict() 2020-07-31 14:35:14 +01:00
George Peter Banyard 0ba31e19c6 Change leftover RETURN_FALSE to RETURN_THROWS() from 4095c0a 2020-07-31 14:11:10 +01:00
George Peter Banyard 4095c0a28d Promote empty filename to ValueError in BZ2 extension 2020-07-31 14:01:05 +01:00
George Peter Banyard c3105a1f8d ValueError for empty path in stream code
Closes GH-5902
2020-07-31 13:39:58 +01:00
George Peter Banyard f78a091014 Warning to ValueError promotion in Intl extension Part 1
Affects:
- IntlCalendar
- IntlGregorianCalendar
- IntlBreakIterator

Closes GH-5669
2020-07-31 13:27:22 +01:00
Dmitry Stogov b3e12325f6 Fixed JIT when result of ASSIGN is in register, but the original variable might need to be destroyed 2020-07-31 12:31:46 +03:00
Máté Kocsis d94d426f60 Fix the default value handling of imagegif() 2020-07-31 10:01:08 +02:00
Nikita Popov 47e4001976 Remove more unused func_info fields 2020-07-30 18:50:12 +02:00
Dmitry Stogov 8ea9e1ae4c We check result type guard in FETCH_DIM_R/IS only if index is long or string. 2020-07-30 19:19:10 +03:00