Skip to content

Commit

Permalink
bug #239 Fix support for preloading (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.15-dev branch.

Discussion
----------

Fix support for preloading

Fixes #238

Commits
-------

c06a95e Fix support for preloading
  • Loading branch information
nicolas-grekas committed Mar 11, 2020
2 parents 5107cf9 + c06a95e commit b117324
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@
* added `preg_last_error_msg()` to the PHP 8 polyfill
* added interface `Stringable` to the PHP 8 polyfill
* added support for UUID V3 and V5
* fixed support for preloading

# 1.14.0

Expand Down
4 changes: 3 additions & 1 deletion src/Iconv/bootstrap.php
Expand Up @@ -11,12 +11,14 @@

use Symfony\Polyfill\Iconv as p;

if (!function_exists('iconv')) {
if (!defined('ICONV_IMPL')) {
define('ICONV_IMPL', 'Symfony');
define('ICONV_VERSION', '1.0');
define('ICONV_MIME_DECODE_STRICT', 1);
define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2);
}

if (!function_exists('iconv')) {
function iconv($from, $to, $s) { return p\Iconv::iconv($from, $to, $s); }
function iconv_get_encoding($type = 'all') { return p\Iconv::iconv_get_encoding($type); }
function iconv_set_encoding($type, $charset) { return p\Iconv::iconv_set_encoding($type, $charset); }
Expand Down
4 changes: 3 additions & 1 deletion src/Intl/Grapheme/bootstrap.php
Expand Up @@ -11,11 +11,13 @@

use Symfony\Polyfill\Intl\Grapheme as p;

if (!function_exists('grapheme_strlen')) {
if (!defined('GRAPHEME_EXTR_COUNT')) {
define('GRAPHEME_EXTR_COUNT', 0);
define('GRAPHEME_EXTR_MAXBYTES', 1);
define('GRAPHEME_EXTR_MAXCHARS', 2);
}

if (!function_exists('grapheme_strlen')) {
function grapheme_extract($s, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($s, $size, $type, $start, $next); }
function grapheme_stripos($s, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($s, $needle, $offset); }
function grapheme_stristr($s, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($s, $needle, $beforeNeedle); }
Expand Down
4 changes: 3 additions & 1 deletion src/Intl/Idn/bootstrap.php
Expand Up @@ -11,7 +11,7 @@

use Symfony\Polyfill\Intl\Idn as p;

if (!function_exists('idn_to_ascii')) {
if (!defined('IDNA_DEFAULT')) {
define('U_IDNA_PROHIBITED_ERROR', 66560);
define('U_IDNA_ERROR_START', 66560);
define('U_IDNA_UNASSIGNED_ERROR', 66561);
Expand Down Expand Up @@ -48,7 +48,9 @@
define('IDNA_ERROR_INVALID_ACE_LABEL', 1024);
define('IDNA_ERROR_BIDI', 2048);
define('IDNA_ERROR_CONTEXTJ', 4096);
}

if (!function_exists('idn_to_ascii')) {
if (PHP_VERSION_ID < 70400) {
function idn_to_ascii($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { return p\Idn::idn_to_ascii($domain, $options, $variant, $idna_info); }
function idn_to_utf8($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { return p\Idn::idn_to_utf8($domain, $options, $variant, $idna_info); }
Expand Down
4 changes: 3 additions & 1 deletion src/Mbstring/bootstrap.php
Expand Up @@ -11,11 +11,13 @@

use Symfony\Polyfill\Mbstring as p;

if (!function_exists('mb_strlen')) {
if (!defined('MB_CASE_UPPER')) {
define('MB_CASE_UPPER', 0);
define('MB_CASE_LOWER', 1);
define('MB_CASE_TITLE', 2);
}

if (!function_exists('mb_strlen')) {
function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
Expand Down
4 changes: 3 additions & 1 deletion src/Php56/bootstrap.php
Expand Up @@ -15,10 +15,12 @@
if (!function_exists('hash_equals')) {
function hash_equals($knownString, $userInput) { return p\Php56::hash_equals($knownString, $userInput); }
}
if (extension_loaded('ldap') && !function_exists('ldap_escape')) {
if (extension_loaded('ldap') && !defined('LDAP_ESCAPE_FILTER')) {
define('LDAP_ESCAPE_FILTER', 1);
define('LDAP_ESCAPE_DN', 2);
}

if (extension_loaded('ldap') && !function_exists('ldap_escape')) {
function ldap_escape($subject, $ignore = '', $flags = 0) { return p\Php56::ldap_escape($subject, $ignore, $flags); }
}

Expand Down
4 changes: 3 additions & 1 deletion src/Uuid/bootstrap.php
Expand Up @@ -11,7 +11,7 @@

use Symfony\Polyfill\Uuid as p;

if (!function_exists('uuid_create')) {
if (!defined('UUID_TYPE_DEFAULT')) {
define('UUID_VARIANT_NCS', 0);
define('UUID_VARIANT_DCE', 1);
define('UUID_VARIANT_MICROSOFT', 2);
Expand All @@ -25,7 +25,9 @@
define('UUID_TYPE_SHA1', 5);
define('UUID_TYPE_NULL', -1);
define('UUID_TYPE_INVALID', -42);
}

if (!function_exists('uuid_create')) {
function uuid_create($type = UUID_TYPE_DEFAULT) { return p\Uuid::uuid_create($type); }
function uuid_generate_md5($uuid_ns, $name) { return p\Uuid::uuid_generate_md5($uuid_ns, $name); }
function uuid_generate_sha1($uuid_ns, $name) { return p\Uuid::uuid_generate_sha1($uuid_ns, $name); }
Expand Down

0 comments on commit b117324

Please sign in to comment.