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

13707 Commits

Author SHA1 Message Date
Ikko Ashimine 6e5771148d Fix typo in file.c
apostrohpe -> apostrophe
2021-08-25 09:51:32 +02:00
Máté Kocsis b1822899fc Add support for generating optimizer function info from stubs (#7367) 2021-08-24 16:35:33 +02:00
Máté Kocsis b4b980e6ad Merge branch 'PHP-8.0'
* PHP-8.0:
  Declare a few missing function return types
2021-08-24 11:43:31 +02:00
Máté Kocsis c58a9f2a57 Declare a few missing function return types
Closes GH-7395
2021-08-24 11:38:50 +02:00
Nikita Popov 05a217927a Declare php_user_filter::$stream property
This property is temporarily set during the filter() call. I have
no idea why this wasn't added as an argument to filter() instead.
2021-08-20 14:50:25 +02:00
Nikita Popov 7f7a90b2bc Remove php_user_filter::$filter property
This property was formerly used to hold the php_stream_filter
pointer for destruction purposes. However, this is no longer used,
and we don't need to create this resource at all.
2021-08-20 14:39:53 +02:00
Nikita Popov 29c6eb6cf5 Declare Directory properties
Some error handling test changes, as changes to the $handle
property are now detected earlier.
2021-08-19 10:39:23 +02:00
Nikita Popov ef5558a8cd Use zend_string for putenv key (#7379)
A zend_string will be created anyway for the hash key,
so we may as well create one in the first place.
2021-08-17 12:29:04 +02:00
Christoph M. Becker 02b725a269 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #71542: disk_total_space does not work with relative paths
2021-08-17 11:32:24 +02:00
Christoph M. Becker e45a063f4b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #71542: disk_total_space does not work with relative paths
2021-08-17 11:31:14 +02:00
Christoph M. Becker f924e97269 Fix #71542: disk_total_space does not work with relative paths
For ZTS builds, we need to expand the path given to `disk_free_space()`
and `disk_total_space()` to properly support the VCWD.

Closes GH-7377.
2021-08-17 11:29:33 +02:00
Nikita Popov b56699b8f0 Use system allocator for putenv value
The putenv value is stored in environ. If for some reason we
fail to restore it on shutdown, make sure that we fail gracefully
by using a system allocated value, rather than a ZMM allocated one.

This is an additional mitigation for bug #81316 style issues if
all else fails.
2021-08-17 11:03:14 +02:00
Nikita Popov 6e20f0f3a2 Returned interned string from fgetc()
Make use of single-character interned strings.
2021-08-16 11:15:23 +02:00
Nikita Popov 4a4ae45a0b Fix bug #81142 by adding zend_string_init_existing_interned()
Add a new interned string handler that fetches an interned string
if it exists, but does not create one if it does not (and instead
returns a non-interned string).

This fixes bug #81142, by preventing the creating of new interned
strings for unserialized array keys.

Closes GH-7360.
2021-08-12 11:57:50 +02:00
George Peter Banyard 98eb60a635 Refactor proc_open() implementation (#7255)
* Convert int return types to zend_result in proc_open.c

* Use bool instead of int type

* Use HashTable directly instead of zval

* Convert command field of process handle to zend_string
* proc_open() micro-optimization for Windows

Prevents some calls to strlen() on Windows
2021-08-11 14:51:55 +02:00
Christoph M. Becker e8a34d6cdf Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix SKIPIF clause
2021-08-11 11:13:49 +02:00
Christoph M. Becker 47aaffcdee Fix SKIPIF clause 2021-08-11 11:11:34 +02:00
Jeremy Mikola 858d0c0916 Include class name in Serializable deprecation message
The deprecation message was originally introduced in 3e6b447 (#6494).

I first encountered this notice when testing the MongoDB extension
with PHP 8.1, which produced many duplicate messages that provided
no detail about the particular class that needed to be fixed.

Closes GH-7346.
2021-08-11 10:35:47 +02:00
Christoph M. Becker e9b28528d6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81346: Non-seekable streams don't update position after write
2021-08-10 16:51:56 +02:00
Christoph M. Becker a2b92d6baa Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81346: Non-seekable streams don't update position after write
2021-08-10 16:50:36 +02:00
Christoph M. Becker 4a1af1f871 Fix #81346: Non-seekable streams don't update position after write
The stream position is not related to the buffer, and needs to be
updated for non-seekable streams as well.  The erroneous condition
around the position update is a relict of an old commit[1].

The unexpected test expectation is due to bug #81345.

[1] <https://github.com/php/php-src/commit/088e2692c3d1e680fd3d9306c4adb417e761acff>

Closes GH-7356.
2021-08-10 16:49:07 +02:00
Christoph M. Becker 961ac1f0fb Use --EXTENSIONS-- instead of --SKIPIF-- in new test case 2021-08-10 16:46:39 +02:00
Christoph M. Becker 4ff82eb96a Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81302: Stream position after stream filter removed
2021-08-10 16:42:03 +02:00
Christoph M. Becker 2e71c94c9b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81302: Stream position after stream filter removed
2021-08-10 16:41:14 +02:00
Christoph M. Becker 40b31fcc80 Fix #81302: Stream position after stream filter removed
When flushing the stream filters actually causes data to be written to
the stream, we need to update its position, because that is not done by
the streams' write methods.

Closes GH-7354.
2021-08-10 16:39:55 +02:00
David CARLIER e836143ad7 Fix dns resolv linkage issue on haiku (#7350) 2021-08-10 15:46:52 +02:00
Nikita Popov 604848188b Add additional double to string APIs
zend_double_to_str() converts a double to string in the way that
(string) would (using %.*H using precision).

smart_str_append_double() provides some more fine control over
the precision, and whether a zero fraction should be appeneded
for whole numbers.

A caveat here is that raw calls to zend_gcvt and going through
s*printf has slightly different behavior for the degenarate
precision=0 case. zend_gcvt will add a dummy E+0 in that case,
while s*printf convert this to precision=1 and will not. I'm
going with the s*printf behavior here, which is more common,
but does result in a minor change to the precision.phpt test.
2021-08-02 16:14:53 +02:00
Nikita Popov e14fbc84ac Remove FORMAT_CONV_MAX_PRECISION
This used to be necessary in the past because the NUM_BUF_SIZE
was set to 512, which is shorter than DOUBLE_MAX_LENGTH. Now the
value is either DOUBLE_MAX_LENGTH or larger (2048).
2021-08-02 15:59:26 +02:00
Nikita Popov d28f6e694d Move php_gcvt to zend_gcvt
Also move PHP_DOUBLE_MAX_LENGTH to ZEND_DOUBLE_MAX_LENGTH.
2021-08-02 14:51:46 +02:00
Kamil Tekiela cd0cd3d31e Fix typos (#7327) 2021-08-01 18:03:30 +01:00
Nikita Popov 1a370d3321 Skip some tests under --preload
A genuine problem here is that we sometime get different class
casing due interaction with the ZSTR CE cache. Ignore these for
now.
2021-07-30 17:26:39 +02:00
Nikita Popov 06cf4ff03e Tweak some tests to be --preload compatible
Avoid unnecessary output before a deprecation warning.
2021-07-30 17:26:32 +02:00
Nikita Popov 185212109c Fix session + Serializable tests
These were broken when the deprecation warning was added, as the
extra output prevented the session from being started.
2021-07-30 16:13:05 +02:00
Nikita Popov 9e66455fbc Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix parameter name in count() error message
2021-07-29 14:25:22 +02:00
Nikita Popov 6c7b322de2 Fix parameter name in count() error message
This parameter has been renamed to $value.
2021-07-29 14:25:13 +02:00
Nikita Popov fc45223f85 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix parameter name in call_user_func() error message
2021-07-29 12:49:17 +02:00
Nikita Popov 840e441d2d Fix parameter name in call_user_func() error message
This parameter name has been changed to $callback.
2021-07-29 12:48:25 +02:00
Christoph M. Becker ccb6642c91 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81294: Segfault when removing a filter
2021-07-27 12:17:07 +02:00
Christoph M. Becker bf9afc184f Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81294: Segfault when removing a filter
2021-07-27 12:14:22 +02:00
Christoph M. Becker 1fa26eccba Fix #81294: Segfault when removing a filter
We need to call the proper method.

Closes GH-7308.
2021-07-27 12:12:02 +02:00
Máté Kocsis 663536d7d9 Improve class inheritance error messages (#7307) 2021-07-27 09:42:37 +02:00
Nikita Popov 6d505d4445 Add RETURN/RETVAL_COPY_DEREF() macros
These were missing from the set...

I think quite a few of these usages don't actually need the DEREF,
but I've just kept things as is for now.
2021-07-22 09:44:19 +02:00
Máté Kocsis 23b1c4a982 Migrate to PHP-Parser 4.12.0 and regenerate some arginfos 2021-07-22 09:40:16 +02:00
Levi Morrison ae8647d9d3 Remove leading underscore for _zend_hash_find_known_hash (#7260)
Convert zend_hash_find_ex(..., 1) to zend_hash_find_known_hash(...)
Convert zend_hash_find_ex(..., 0) to zend_hash_find(...)

Also add serializable changes to UPGRADING.INTERNALS summary
2021-07-20 17:07:17 -06:00
Nikita Popov bf92bddb87 Merge branch 'PHP-8.0'
* PHP-8.0:
  Create persistent interned string for password algos
2021-07-20 15:14:08 +02:00
Nikita Popov b0d4d6ebb4 Create persistent interned string for password algos
These strings are returned to userland by password_algos(),
which violates thread-safety invariants. Create persistent
interned strings for them instead.
2021-07-20 15:13:50 +02:00
Nikita Popov 814a932734 Add ZEND_ACC_NOT_SERIALIZABLE flag
This prevents serialization and unserialization of a class and its
children in a way that does not depend on the zend_class_serialize_deny
and zend_class_unserialize_deny handlers that will be going away
in PHP 9 together with the Serializable interface.

In stubs, `@not-serializable` can be used to set this flag.

This patch only uses the new flag for a handful of Zend classes,
converting the remainder is left for later.

Closes GH-7249.
Fixes bug #81111.
2021-07-19 15:59:11 +02:00
David Carlier ffc30c5b8d getrandom support for DragonFlyBSD too.
supported since the 5.7.x release, actually 5.8.x is the stable one.
2021-07-19 15:12:43 +02:00
Máté Kocsis 75a678a7e3 Declare tentative return types for Zend (#7251)
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 13:44:20 +02:00
Nikita Popov f2e374c881 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix bug #81265: getimagesize returns 0 for 256px ICO images
2021-07-16 10:07:35 +02:00