Skip to content

Commit 805b743

Browse files
IonBazannicolas-grekas
authored andcommitted
[PHP 8.3] Polyfill new non-overloaded variants of functions
1 parent b74a70d commit 805b743

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ This component provides features added to PHP 8.3 core:
66
- [`json_validate`](https://wiki.php.net/rfc/json_validate)
77
- [`Override`](https://wiki.php.net/rfc/marking_overriden_methods)
88
- [`mb_str_pad`](https://wiki.php.net/rfc/mb_str_pad)
9+
- [`ldap_exop_sync`](https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures)
10+
- [`ldap_connect_wallet`](https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures)
11+
- [`stream_context_set_options`](https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures)
912

1013
More information can be found in the
1114
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).

bootstrap.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,19 @@ function json_validate(string $json, int $depth = 512, int $flags = 0): bool { r
2222
if (!function_exists('mb_str_pad') && function_exists('mb_substr')) {
2323
function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Php83::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); }
2424
}
25+
26+
if (!function_exists('stream_context_set_options')) {
27+
function stream_context_set_options($context, array $options): bool { return stream_context_set_option($context, $options); }
28+
}
29+
30+
if (\PHP_VERSION_ID >= 80100) {
31+
return require __DIR__.'/bootstrap81.php';
32+
}
33+
34+
if (!function_exists('ldap_exop_sync') && function_exists('ldap_exop')) {
35+
function ldap_exop_sync($ldap, string $request_oid, string $request_data = null, array $controls = null, &$response_data = null, &$response_oid = null): bool { return ldap_exop($ldap, $request_oid, $request_data, $controls, $response_data, $response_oid); }
36+
}
37+
38+
if (!function_exists('ldap_connect_wallet') && function_exists('ldap_connect')) {
39+
function ldap_connect_wallet(?string $uri, string $wallet, string $password, int $auth_mode = \GSLC_SSL_NO_AUTH) { return ldap_connect($uri, $wallet, $password, $auth_mode); }
40+
}

bootstrap81.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
if (\PHP_VERSION_ID >= 80300) {
13+
return;
14+
}
15+
16+
if (!function_exists('ldap_exop_sync') && function_exists('ldap_exop')) {
17+
function ldap_exop_sync(\LDAP\Connection $ldap, string $request_oid, string $request_data = null, array $controls = null, &$response_data = null, &$response_oid = null): bool { return ldap_exop($ldap, $request_oid, $request_data, $controls, $response_data, $response_oid); }
18+
}
19+
20+
if (!function_exists('ldap_connect_wallet') && function_exists('ldap_connect')) {
21+
function ldap_connect_wallet(?string $uri, string $wallet, #[\SensitiveParameter] string $password, int $auth_mode = \GSLC_SSL_NO_AUTH): \LDAP\Connection|false { return ldap_connect($uri, $wallet, $password, $auth_mode); }
22+
}

0 commit comments

Comments
 (0)