1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Commit Graph

139937 Commits

Author SHA1 Message Date
David Carlier
466f3257eb ext/sockets: socket_addrinfo_lookup and other few internal changes
- socket_addrinfo_lookup throws when hints is an indexed array.
- socket_get_option hardcoding size outputs to user when data
  size known.

close GH-17363
2025-01-05 13:32:12 +00:00
Gina Peter Banyard
7c32e41ab8 ext/spl: Refactor iterator_apply() to not rely on an FCI
This reduces the size of the struct from 112 to 56 bytes
2025-01-05 12:27:28 +00:00
Gina Peter Banyard
3de22a84e8 ext/spl: Add trampoline test for iterator_apply() 2025-01-05 12:27:28 +00:00
Gina Peter Banyard
e547fe40df ext/spl: Remove useless obj field from spl_iterator_apply_info 2025-01-05 12:27:28 +00:00
Niels Dossche
73f52dc729 Remove custom free_obj handler in xmlwriter
At one point this served a purpose as it contained the cleanup code that
now lives in dtor, but now it just calls the standard handler so we can
just get rid of it.
2025-01-05 13:05:06 +01:00
Christoph M. Becker
a3ef48c265 Port "move pixelate filter to gd_filter.c" (sync with upstream) (GH-17361)
Cf. <0f0894a7dd>.
2025-01-05 11:24:24 +01:00
DanielEScherzer
025cc6f603 UPGRADING: fix misplaced () (#17360)
[skip ci]
2025-01-04 17:42:06 +00:00
Niels Dossche
9da8ace8ea Merge branch 'PHP-8.4'
* PHP-8.4:
  Handle GC cycles properly in intl iterators
2025-01-04 17:49:45 +01:00
Niels Dossche
3240f478bc Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Handle GC cycles properly in intl iterators
2025-01-04 17:49:39 +01:00
Niels Dossche
ee2faaa423 Handle GC cycles properly in intl iterators
This is a follow-up on GH-17343 to implement GC cycle management.
Previously the objects lived too long due to the strong cycle.
This patch adds get_gc handlers to break the cycle.

Closes GH-17355.
2025-01-04 17:42:18 +01:00
Niels Dossche
ac8b7b8aaf Fix wrong comment and use cheaper destruction macro (#17359) 2025-01-04 17:18:53 +01:00
Niels Dossche
7be3649016 Cleanup iterator instantiation code (#17358)
Just using object_init_ex() directly makes the code a bit simpler and
avoids unnecessary indirections.
2025-01-04 16:48:41 +01:00
Niels Dossche
b21c16908e Convert more commonly used DOM element methods to use fast ZPP (#17357) 2025-01-04 16:48:34 +01:00
David Carlier
c7a322cc4c ext/sockets: follow-up on GH-17300 to check hints value ranges.
close GH-17326
2025-01-04 15:39:53 +00:00
Niels Dossche
0a69e14278 Avoid copying request strings in phar_parse_pharfile() 2025-01-04 14:08:33 +00:00
Niels Dossche
9e3508bfa8 Fix persistent local flag on filename zend_strings in phar (#17353)
This fixes the nightly failure.
2025-01-04 14:56:26 +01:00
Christoph M. Becker
5ba2143c1c Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17349: Tiled truecolor filling looses single color transparency
2025-01-04 14:54:27 +01:00
Christoph M. Becker
5a01c3293a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17349: Tiled truecolor filling looses single color transparency
2025-01-04 14:54:11 +01:00
Christoph M. Becker
2c658f422d Fix GH-17349: Tiled truecolor filling looses single color transparency
This is porting the relevant part of a previous upstream commit[1] to
align the behavior of our bundled libgd with upstream.  It should be
noted that this only works if the image actually has a transparent
color.

[1] <4770e2b2d5>

Closes GH-17351.
2025-01-04 14:53:18 +01:00
Christoph M. Becker
2490097420 Port insertion sort improvement of libgd 2.0.26 (GH-17342)
Possibly a minor performance improvement, but at least in sync with
upstream this way.
2025-01-04 13:13:06 +01:00
Niels Dossche
209e0d6ad2 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-11874: intl causing segfault in docker images
2025-01-03 18:58:42 +01:00
Niels Dossche
0ee6691bbc Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-11874: intl causing segfault in docker images
2025-01-03 18:58:36 +01:00
Niels Dossche
a970eefb6c Fix GH-11874: intl causing segfault in docker images
The segfault happens because zoi->wrapping_obj points to an object that has been freed.
This wrapping_obj is set in IntlIterator_from_StringEnumeration().
Notice how the refcount is not increased in this function.
By switching to ZVAL_OBJ_COPY, the segfault disappears.

We also need to move the responsibility of destroying the iterator to
the iterator itself and keep the object data destruction in the object
destruction. The existing code used a weird recursive destruction
between the iterator and object that was too hard to understand to be
honest. This patch simplifies everything and in the process gets rid of
the leak.

Iterators that are embedded are now responsible for their own
memory cleanup.

Closes GH-17343.
2025-01-03 18:58:15 +01:00
Christoph M. Becker
8a0b617940 Port clip_1d() clipping rectangle improvement of libgd 2.0.26 (GH-17341)
This is not a functional change, but rather a performance improvement,
to avoid unnecessary calls of `gdImageSetPixel()` which would be no-ops
due to positions outside of the clipping bounds.
2025-01-03 18:26:46 +01:00
Niels Dossche
21f4211d1a Use zend_string_{equals,startswith} helpers
Closes GH-17240.
2025-01-03 17:59:58 +01:00
Niels Dossche
c7b80e640e Transform phar_entry_info filename to zend_string
The contents of the string are copied many times, especially in hash
tables. Avoid all this work by using zend_string in the first place.
2025-01-03 17:59:04 +01:00
Niels Dossche
49fa2e4651 Make some arguments of dom_get_elements_by_tag_name_ns_raw() const 2025-01-03 17:50:01 +01:00
Niels Dossche
59a0d00a5d Avoid string duplications in dom iterators 2025-01-03 17:50:01 +01:00
Niels Dossche
4c3aeec74f Minor cleanups in namednodemap.c (#17340) 2025-01-03 17:33:29 +01:00
Gina Peter Banyard
0fe3a91494 main/streams: Remove questionable use of PHP_STRLCPY
The description of PHP_STRLCPY says that this is a fast version of strlcpy that should be used if we *know* the size of both the source and destination buffers.
This is clearly not the case as we use strlen() to compute it.
Moreover if the result cannot fit in the destination buffer something seriously strange has happened and we should return a failure state rather than truncating.
2025-01-03 13:45:23 +00:00
Christoph M. Becker
f55d6cc110 Internalize gdImageScale*() and gdImageRotate*() helpers
This is basically a port of the "Small code cleanup" commit[1].

We can now drop the superfluous checks for zero width/height.  These
have been introduced as fix for bug 72337[2], while the same issue had
a simpler fix for upstream[3], because the helper functions already
were internal.

[1] <e054be7d82>
[2] <https://bugs.php.net/72337>
[3] <77309c419c>
2025-01-03 14:26:36 +01:00
Christoph M. Becker
11d701a6ab Port fix for libgd bug 447 (GH-17320)
That bug has been potentially exploitable[1], but the GD extension was
not affected by that, because `gdImageBmpPtr()` is never called.  Still
it seems to be reasonable to port the fix; if only to keep bundled and
external libgd synced.

[1] <https://github.com/advisories/GHSA-hc3p-jvff-jfw5>
2025-01-03 12:57:12 +01:00
Niels Dossche
2dfe92767d Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16800: ftp functions can abort with EINTR
2025-01-03 12:31:13 +01:00
Niels Dossche
e90243a640 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16800: ftp functions can abort with EINTR
2025-01-03 12:31:08 +01:00
Niels Dossche
412a6b2e08 Fix GH-16800: ftp functions can abort with EINTR
This adds wrappers around recv(), send(), and php_pollfd_for_ms() to
handle EINTR.

This is a bit hard to test on its own, but it is testable manually using
the following script:
```php
pcntl_signal(SIGUSR1, function() {
    var_dump(func_get_args());
}, false);

var_dump(getmypid());
sleep(10);

$ftp = ftp_connect('127.0.0.1');
ftp_login($ftp, 'user', 'pass');
ftp_put($ftp, 'testfile', 'testfile');
```

in combination with an infinite while loop that sends SIGUSR1 to the
process.

Closes GH-17327.
2025-01-03 12:30:43 +01:00
Niels Dossche
309e66d984 Use zend_new_pair() for hrtime() (#17328)
This is a specialised optimized helper to return a pair.
2025-01-03 12:28:14 +01:00
Gina Peter Banyard
60252b7845 ext/pdo: Improve testing for FETCH_FUNC mode (#17325) 2025-01-02 23:31:25 +00:00
David Carlier
b7c76ded31 ext/socket: socket_addrinfo_lookup check hints array.
close GH-17300
2025-01-02 13:14:10 +00:00
Gina Peter Banyard
249d2dac28 ext/pdo: Use memcpy instead of strlcpy for copying default error code (#17290)
They have identical sizes, so there is no need for 'extra' safety.

See https://nrk.neocities.org/articles/not-a-fan-of-strlcpy for a rationale against the usage of strlcpy
2025-01-01 20:23:18 +00:00
Gina Peter Banyard
1969955e50 ext/pdo: Drop redundant mode check, and fix the first check (#17302) 2025-01-01 20:22:39 +00:00
Christoph M. Becker
dfdba3cfe4 Merge branch 'PHP-8.4'
* PHP-8.4:
  gh15937.phpt does not need to be an online test
2025-01-01 20:08:57 +01:00
Christoph M. Becker
862ed7ebe5 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  gh15937.phpt does not need to be an online test
2025-01-01 20:08:04 +01:00
Christoph M. Becker
9999a5b4de Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  gh15937.phpt does not need to be an online test
2025-01-01 20:07:34 +01:00
Christoph M. Becker
919f1984d5 gh15937.phpt does not need to be an online test
We convert the test to use the CLI test server to not require online
availability.

As of PHP 8.3, the test is supposed to fail, because the timeout is too
large.  Since exactly this scenario is already tested by gh16810.phpt,
we drop the test for PHP-8.3 and up.

Closes GH-17315.
2025-01-01 20:06:23 +01:00
Christoph M. Becker
3bfe39f279 Merge branch 'PHP-8.4'
* PHP-8.4:
2025-01-01 20:04:47 +01:00
Christoph M. Becker
37190df423 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.3 is now for PHP-8.3.17-dev
2025-01-01 20:03:06 +01:00
David CARLIER
3e9b530d62 ext/sockets: conversions internal changes. (#17311)
following up on strlcpy removal work too.
2025-01-01 12:13:39 +00:00
Eric Mann
90121f4056 Merge branch 'PHP-8.3' 2024-12-31 09:01:17 -08:00
Eric Mann
717b75cb43 PHP-8.3 is now for PHP-8.3.17-dev 2024-12-31 08:46:21 -08:00
Saki Takamachi
6fb79e269b Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP 8.4.4-dev
2025-01-01 00:53:26 +09:00