This project backports features found in the latest PHP versions and provides compatibility layers for some extensions and functions

Overview

Symfony Polyfill

This project backports features found in the latest PHP versions and provides compatibility layers for some extensions and functions. It is intended to be used when portability across PHP versions and extensions is desired.

Polyfills are provided for:

  • the apcu extension when the legacy apc extension is installed;
  • the ctype extension when PHP is compiled without ctype;
  • the mbstring and iconv extensions;
  • the uuid extension;
  • the MessageFormatter class and the msgfmt_format_message functions;
  • the Normalizer class and the grapheme_* functions;
  • the utf8_encode and utf8_decode functions from the xml extension or PHP-7.2 core;
  • the Collator, NumberFormatter, Locale and IntlDateFormatter classes, limited to the "en" locale;
  • the intl_error_name, intl_get_error_code, intl_get_error_message and intl_is_failure functions;
  • the idn_to_ascii and idn_to_utf8 functions;
  • the hex2bin function, the CallbackFilterIterator, RecursiveCallbackFilterIterator and SessionHandlerInterface classes introduced in PHP 5.4;
  • the array_column, boolval, json_last_error_msg and hash_pbkdf2 functions introduced in PHP 5.5;
  • the password_hash and password_* related functions introduced in PHP 5.5, provided by the ircmaxell/password-compat package;
  • the hash_equals and ldap_escape functions introduced in PHP 5.6;
  • the *Error classes, the error_clear_last, preg_replace_callback_array and intdiv functions introduced in PHP 7.0;
  • the random_bytes and random_int functions introduced in PHP 7.0, provided by the paragonie/random_compat package;
  • the PHP_INT_MIN constant introduced in PHP 7.0,
  • the SessionUpdateTimestampHandlerInterface interface introduced in PHP 7.0,
  • the is_iterable function introduced in PHP 7.1;
  • a Binary utility class to be used when compatibility with mbstring.func_overload is required;
  • the spl_object_id and stream_isatty functions introduced in PHP 7.2;
  • the sapi_windows_vt100_support function (Windows only) introduced in PHP 7.2;
  • the PHP_FLOAT_* constant introduced in PHP 7.2;
  • the PHP_OS_FAMILY constant introduced in PHP 7.2;
  • the is_countable function introduced in PHP 7.3;
  • the array_key_first and array_key_last functions introduced in PHP 7.3;
  • the hrtime function introduced in PHP 7.3;
  • the JsonException class introduced in PHP 7.3;
  • the get_mangled_object_vars, mb_str_split and password_algos functions introduced in PHP 7.4;
  • the fdiv function introduced in PHP 8.0;
  • the get_debug_type function introduced in PHP 8.0;
  • the preg_last_error_msg function introduced in PHP 8.0;
  • the str_contains function introduced in PHP 8.0;
  • the str_starts_with and str_ends_with functions introduced in PHP 8.0;
  • the ValueError class introduced in PHP 8.0;
  • the UnhandledMatchError class introduced in PHP 8.0;
  • the FILTER_VALIDATE_BOOL constant introduced in PHP 8.0;
  • the get_resource_id function introduced in PHP 8.0;
  • the Attribute class introduced in PHP 8.0;
  • the Stringable interface introduced in PHP 8.0;
  • the array_is_list function introduced in PHP 8.1;
  • the MYSQLI_REFRESH_REPLICA constant introduced in PHP 8.1;
  • the ReturnTypeWillChange attribute introduced in PHP 8.1;

It is strongly recommended to upgrade your PHP version and/or install the missing extensions whenever possible. This polyfill should be used only when there is no better choice or when portability is a requirement.

Compatibility notes

To write portable code between PHP5 and PHP7, some care must be taken:

  • \*Error exceptions must be caught before \Exception;
  • after calling error_clear_last(), the result of $e = error_get_last() must be verified using isset($e['message'][0]) instead of null !== $e.

Usage

When using Composer to manage your dependencies, you should not require the symfony/polyfill package, but the standalone ones:

  • symfony/polyfill-apcu for using the apcu_* functions,
  • symfony/polyfill-ctype for using the ctype functions,
  • symfony/polyfill-php54 for using the PHP 5.4 functions,
  • symfony/polyfill-php55 for using the PHP 5.5 functions,
  • symfony/polyfill-php56 for using the PHP 5.6 functions,
  • symfony/polyfill-php70 for using the PHP 7.0 functions,
  • symfony/polyfill-php71 for using the PHP 7.1 functions,
  • symfony/polyfill-php72 for using the PHP 7.2 functions,
  • symfony/polyfill-php73 for using the PHP 7.3 functions,
  • symfony/polyfill-php74 for using the PHP 7.4 functions,
  • symfony/polyfill-php80 for using the PHP 8.0 functions,
  • symfony/polyfill-php81 for using the PHP 8.1 functions,
  • symfony/polyfill-iconv for using the iconv functions,
  • symfony/polyfill-intl-grapheme for using the grapheme_* functions,
  • symfony/polyfill-intl-idn for using the idn_to_ascii and idn_to_utf8 functions,
  • symfony/polyfill-intl-icu for using the intl functions and classes,
  • symfony/polyfill-intl-messageformatter for using the intl messageformatter,
  • symfony/polyfill-intl-normalizer for using the intl normalizer,
  • symfony/polyfill-mbstring for using the mbstring functions,
  • symfony/polyfill-util for using the polyfill utility helpers.
  • symfony/polyfill-uuid for using the uuid_* functions,

Requiring symfony/polyfill directly would prevent Composer from sharing correctly polyfills in dependency graphs. As such, it would likely install more code than required.

Design

This package is designed for low overhead and high quality polyfilling.

It adds only a few lightweight require statements to the bootstrap process to support all polyfills. Implementations are then loaded on-demand when needed during code execution.

If your project requires a minimum PHP version it is advisable to add polyfills for lower PHP versions to the replace section of your composer.json. This removes any overhead from these polyfills as they are no longer part of your project. The same can be done for polyfills for extensions that you require.

If your project requires php 7.0, and needs the mb extension, the replace section would look something like this:

{
    "replace": {
        "symfony/polyfill-php54": "*",
        "symfony/polyfill-php55": "*",
        "symfony/polyfill-php56": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-mbstring": "*"
    }
}

Polyfills are unit-tested alongside their native implementation so that feature and behavior parity can be proven and enforced in the long run.

License

This library is released under the MIT license.

Comments
  • Replace underlying IDN library

    Replace underlying IDN library

    Fixes #159. First attempt to replace the current IDN library with the one from https://github.com/TRowbotham/idna.

    • [x] Modify code to be PHP 5.3 compatible
    • [x] Port over tests
    • [x] Port over build scripts
    opened by TRowbotham 24
  • TODO `PhpToken`

    TODO `PhpToken`

    1. Add new constants: T_NAME_FULLY_QUALIFIED, T_NAME_RELATIVE, T_NAME_QUALIFIED, T_NULLSAFE_OBJECT_OPERATOR, T_ATTRIBUTE and T_MATCH.
    2. Fix PhpToken::tokenize() result: 2.1. Implements T_NAME_RELATIVE and T_NAME_QUALIFIED tokens ((T_STRING T_NS_SEPARATOR)xN or (T_NS_SEPARATOR T_STRING)xN). 2.2. Implement T_NULLSAFE_OBJECT_OPERATOR token (T_STRING '?->' T_STRING) 2.3. Implement T_MATCH token 2.3. Implement T_ATTRIBUTE token
    opened by WinterSilence 21
  • symfony/polyfill-intl-idn 1.16 broken Guzzle for CentOS 6 (old ICU) servers?

    symfony/polyfill-intl-idn 1.16 broken Guzzle for CentOS 6 (old ICU) servers?

    FWIW, today the update to symfony/polyfill-intl-idn v1.16 (from 1.15) just completely broke all my Guzzle usages. This is on a server running CentOS 6 (and therefore old ICU - 4.2.1?) and PHP 7.3

    opened by jonnott 19
  • Could not scan for classes inside

    Could not scan for classes inside "...polyfill-php73/Resources/stubs" which does not appear to be a fil e nor a folder

    Composer noob trying to start a project with a boilerplate package that requires polyfill-php73 (among other things). I kept getting the error in the title of this issue. I finally deleted everything in the directory and tried to isolate this package to see if it was related to the myriad of other packages. Here's what I got:

    composer require symfony/polyfill-php73
    Using version ^1.11 for symfony/polyfill-php73
    ./composer.json has been created
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Package operations: 1 install, 0 updates, 0 removals
      - Installing symfony/polyfill-php73 (v1.11.0): Loading from cache
    Writing lock file
    Generating autoload files
    
    Installation failed, deleting ./composer.json.
    
    
      [RuntimeException]
      Could not scan for classes inside "/srv/www/wordpress-one/public_html/wp-content/plugins/inpsyde-nonces/vendor/symfony/polyfill-php73/Resources/stubs" which does not appear to be a fil
      e nor a folder
    
    
    require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
    

    composer -V shows: Composer version 1.8.6 2019-06-11 15:03:05

    I don't know if I'm doing something wrong or not. I'm trying to do a project with PHP 7.2 so I don't think I even need this, but I'd like to use this particular boilerplate package to develop with. At any rate if someone could point me in the right direction for how to resolve this I'd be grateful. Thanks!

    opened by dleigh 18
  • Zend Server and APC functionality

    Zend Server and APC functionality

    Zend Server tries to implement compatibility with apc by registering compatibility functions with the same name as the APC functions.

    http://files.zend.com/help/Zend-Server-6/content/zend_data_cache_-_configuration_directives.htm

    Specifically, the option is "zend_datacache.apc_compatibility". It looks like it gets aliased to zend_shm_cache_store, which mostly works. Unfortunately, it doesn't support the array form of apc_store(), so every call results in errors:

    "apc_store() expects parameter 1 to be string, array given"

    It looks like this is a problem that other projects have dealt with, and it looks like it's one that's been going on for 8 years or so, so I'm not expecting Zend to fix it anytime soon.

    My inclination would be to add a check to see if the parameter to apcu_add() or apcu_store() is an array, and if so to call the apc function individually for each item in the array. It would maintain compatibility with APC, and fix the issues with Zend Server. It's a little bit of a hack, though, and I figured I'd ask before submitting a PR.

    Alternatively, I could add support for Zend Data Cache to the Symfony Cache Component.

    opened by kategray 15
  • "Class 'p\\Php80' not found" when use str_starts_with() in PHP7.3 or PHP7.4

    Hi,

    In an encrypted environment, in a Windows PHP 7.3 or 7.4 project , we have this error :

    production.ERROR: Class 'p\Php80' not found {"exception":"[object] (Error(code: 0): Class 'p\\Php80' not found at .\api\vendor\symfony\polyfill\src\Php80\bootstrap.php:32) [stacktrace] #00 ...\api\app\Helpers\Env.php(123): str_starts_with('', '...') #01 ...\api\app\Helpers\Env.php(142): App\Helpers\Env::decodeEnvPassword('', '...') #02 ...\api\config\database.php(44): App\Helpers\Env::env_password('...') #03 ...\api\vendor\laravel\lumen-framework\src\Application.php(688): unknown() #04 ...\api\vendor\laravel\lumen-framework\src\Application.php(662): Laravel\Lumen\Application->configure('database') #05 ...\api\vendor\laravel\lumen-framework\src\Application.php(410): Laravel\Lumen\Application->loadComponent('database', Array, 'db') #06 ...\api\vendor\laravel\framework\src\Illuminate\Container\Container.php(805): Laravel\Lumen\Application->Laravel\Lumen\{closure}(Object(Laravel\Lumen\Application), Array) #07 ...\api\vendor\laravel\framework\src\Illuminate\Container\Container.php(691): Illuminate\Container\Container->build(Object(Closure)) #08 ...\api\vendor\laravel\framework\src\Illuminate\Container\Container.php(637): Illuminate\Container\Container->resolve('db', Array) #09 ...\api\vendor\laravel\lumen-framework\src\Application.php(300): Illuminate\Container\Container->make('db', Array) #10 ...\api\vendor\laravel\lumen-framework\src\Application.php(778): Laravel\Lumen\Application->make('db') #11 ...\api\bootstrap\app.php(54): Laravel\Lumen\Application->withEloquent() #12 ...\api\public\index.php(14): unknown() #13 {main} "}

    Any idea what cause this problem ?

    Greetings.

    opened by JL2014 13
  • Incorrect behaviour of mb_strpos

    Incorrect behaviour of mb_strpos

    <?php
    
    var_dump(mb_strpos(null, 'a'));
    

    should print to bool(false) and raise no errors (https://3v4l.org/YXq4M), because the mb_ functions all treat null as the empty string, by design.

    On PHP 8, the symfony polyfill triggers a type error.

    opened by GrahamCampbell 13
  • [RFC] Provide unpolyfill meta-package

    [RFC] Provide unpolyfill meta-package

    When extension is installed, the related polyfill is not need, but is still downloaded + bootstraped.

    The idea is to provide composer meta-package (without code) to avoid that

    {
      "name": "symfony/not-polyfill-intl",
      "require": {
        "ext-intl": "*"
      },
      "replace": {
        "symfony/polyfill-intl-grapheme": "*",
        "symfony/polyfill-intl-icu": "*",
        "symfony/polyfill-intl-idn": "*",
        "symfony/polyfill-intl-normalizer": "*",
      }
    }
    
    {
      "name": "symfony/not-polyfill-php73",
      "require": {
        "php": ">=7.3"
      },
      "replace": {
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
      }
    }
    

    users can just composer req symfony/not-polyfill-php73 to remove those un-needed packages.

    WDYT?

    opened by jderusse 13
  • Check PHP version in stubs classes

    Check PHP version in stubs classes

    I added a test in stubs classes to prevent php -l to fail on polyfills (errors like PHP Fatal error: Cannot declare class ArithmeticError, because the name is already in use)

    • add test to lint polyfill files
    • make lint test pass
    opened by jdeniau 13
  • str_contains behaviour differs from php8 behaviour

    str_contains behaviour differs from php8 behaviour

    It looks like the PHP8 behaviour for str_contains actually silently accepts a null value (casting it to the empty string), whereas the polyfill doesn't. See this comparison on 3v4l, where you can see that the polyfill throws a TypeError but PHP8 doesn't. The same is probably true for the other str methods, but I haven't confirmed it yet.

    Happy to send a PR (possibly just easiest to remove the types from the params?)

    opened by PatrickRose 12
  • [BUG] polyfill-intl-idn breaks on large hoster installation

    [BUG] polyfill-intl-idn breaks on large hoster installation

    We use the intl-idn package in TYPO3 CMS and it helps a lot! Thank you for providing such a package.

    However there is one large TYPO3 hoster (having roughly 200.000 TYPO3 installations), where they have a messed up Server setup regarding to ICU version on their system. In short: They provide the php-intl extension, but do not define all constants as needed for PHP 7.2+. We had solved this issue in the past by a hard workaround, but with the update to polyfill-intl-idn 1.17.1 and 1.18.0 then (respective change) https://github.com/symfony/polyfill-intl-idn/commit/3bff59ea7047e925be6b7f2059d60af31bb46d6a (or https://github.com/symfony/polyfill/commit/f968149bedaaa9013d39fecd9cab1139aba1334a#diff-eaa55ac0b04a1928e5455b4f48efe417R14-R17) our setups don't work on the hoster anymore, as they clearly have a misconfiguration.

    Still, the previous solution when not checking on the extension_loaded() was more robust for these kind of weird setups.

    In any case, I'm (personally) fine if you decide to keep the extension_loaded() check in your library, but wanted to let you know that this actually is an issue for a lot of people. It would be great to know if you're able to fix it or planning to fix/revert the three lines or if we should find a workaround for ourselves in our project.

    opened by bmack 12
  • polyfill-mbstring: mb_check_encoding crashes for array input

    polyfill-mbstring: mb_check_encoding crashes for array input

    Hi, mb_check_encoding accepts an array of strings: https://3v4l.org/i5MBi

    But Symfony\Polyfill\Mbstring\Mbstring::mb_check_encoding crashes with the same input:

    Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /Users/ondrej/Development/phpstan/vendor/symfony/polyfill-mbstring/Mbstring.php:440
    #0 /Users/ondrej/Development/phpstan/vendor/symfony/polyfill-mbstring/Mbstring.php(440): preg_match('//u', Array)
    #1 /Users/ondrej/Development/phpstan/vendor/symfony/polyfill-mbstring/Mbstring.php(416): Symfony\Polyfill\Mbstring\Mbstring::mb_detect_encoding(Array, Array)
    #2 /Users/ondrej/Development/phpstan/src/Type/Php/StrCaseFunctionsReturnTypeExtension.php(82): Symfony\Polyfill\Mbstring\Mbstring::mb_check_encoding(Array, 'UTF-8')
    

    Tested with symfony/polyfill-mbstring v1.27.0.

    Thanks :)

    opened by ondrejmirtes 0
  • mb_strlen returns 0 instead of 1 for the char chr(254)

    mb_strlen returns 0 instead of 1 for the char chr(254)

    Hi,

    With the polyfill, var_dump(mb_strlen(chr(254))) return 0. With the php8.0-mbstring extension, var_dump(mb_strlen(chr(254))) return 1;

    versions : * v1.26.0

    Thanks, Alex

    opened by alexchuin 0
  • [PHP 8.2] Add `ini_parse_quantity` function

    [PHP 8.2] Add `ini_parse_quantity` function

    opened by Ayesh 2
  •  iconv(): Wrong encoding, conversion from

    iconv(): Wrong encoding, conversion from "ASCII" to "UTF-8//IGNORE" is not allowed

    Hello,

    I noticed that there is an incompatibility with the mbstring polyfill and PHP 8.1 / Alpine Linux, which breaks a lot of my projects as soon as the php81-mbstring is not installed, but php81-iconv is installed:

    Example:

    Warning: iconv(): Wrong encoding, conversion from "ASCII" to "UTF-8//IGNORE" is not allowed in phar:///var/www/localhost/htdocs/phpstan.phar/vendor/symfony/polyfill-mbstring/Mbstring.php on line 736
    

    It looks like //IGNORE is not accepted since echo iconv('UTF-8', 'UTF-8', 'test'); works, while echo iconv('UTF-8', 'UTF-8//IGNORE', 'test'); doesn't

    opened by danielmarschall 2
  • grapheme_strlen shows different length of emoji ZWJ Sequence when compared to native

    grapheme_strlen shows different length of emoji ZWJ Sequence when compared to native

    Take the following emoji for instance: ๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ

    This emoji consists of four different emojis glued together by Zero Width Joiner characters, as seen on https://emojipedia.org/family-woman-woman-boy-boy/.

    When checking the length with grapheme_strlen(), it returns 1, while this library returns 4.

    This is possibly due to a bug on the GRAPHEME_CLUSTER_RX regex.

    This bug should only happen on PCRE_VERSION < 8.32, however, when combined with the bug #369 , it applies to all PCRE_VERSION that contains a date timestamp, which seems to be the default format.

    Therefore, the grapheme_strlen function in this polyfill is likely to provide incorrect results, such as in this example:

    Expected result grapheme_strlen('๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ'):

    The test is being conducted using the regex: \X
    
    int(1)
    int(1)
    int(1)
    int(1)
    

    Actual result with the custom cluster grapheme_strlen('๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ'):

    The test is being conducted using the regex: (?:\r\n|(?:[ -~\x{200C}\x{200D}]|[แ†จ-แ‡น]+|[แ„€-แ…Ÿ]*(?:[๊ฐ€๊ฐœ๊ฐธ๊ฑ”๊ฑฐ๊ฒŒ๊ฒจ๊ณ„๊ณ ๊ณผ๊ด˜๊ดด๊ต๊ตฌ๊ถˆ๊ถค๊ท€๊ทœ๊ทธ๊ธ”๊ธฐ๊นŒ๊นจ๊บ„๊บ ๊บผ๊ป˜๊ปด๊ผ๊ผฌ๊ฝˆ๊ฝค๊พ€๊พœ๊พธ๊ฟ”๊ฟฐ๋€Œ๋€จ๋„๋ ๋ผ๋‚˜๋‚ด๋ƒ๋ƒฌ๋„ˆ๋„ค๋…€๋…œ๋…ธ๋†”๋†ฐ๋‡Œ๋‡จ๋ˆ„๋ˆ ๋ˆผ๋‰˜๋‰ด๋Š๋Šฌ๋‹ˆ๋‹ค๋Œ€๋Œœ๋Œธ๋”๋ฐ๋ŽŒ๋Žจ๋„๋ ๋ผ๋˜๋ด๋‘๋‘ฌ๋’ˆ๋’ค๋“€๋“œ๋“ธ๋””๋”ฐ๋•Œ๋•จ๋–„๋– ๋–ผ๋—˜๋—ด๋˜๋˜ฌ๋™ˆ๋™ค๋š€๋šœ๋šธ๋›”๋›ฐ๋œŒ๋œจ๋„๋ ๋ผ๋ž˜๋žด๋Ÿ๋Ÿฌ๋ ˆ๋ ค๋ก€๋กœ๋กธ๋ข”๋ขฐ๋ฃŒ๋ฃจ๋ค„๋ค ๋คผ๋ฅ˜๋ฅด๋ฆ๋ฆฌ๋งˆ๋งค๋จ€๋จœ๋จธ๋ฉ”๋ฉฐ๋ชŒ๋ชจ๋ซ„๋ซ ๋ซผ๋ฌ˜๋ฌด๋ญ๋ญฌ๋ฎˆ๋ฎค๋ฏ€๋ฏœ๋ฏธ๋ฐ”๋ฐฐ๋ฑŒ๋ฑจ๋ฒ„๋ฒ ๋ฒผ๋ณ˜๋ณด๋ด๋ดฌ๋ตˆ๋ตค๋ถ€๋ถœ๋ถธ๋ท”๋ทฐ๋ธŒ๋ธจ๋น„๋น ๋นผ๋บ˜๋บด๋ป๋ปฌ๋ผˆ๋ผค๋ฝ€๋ฝœ๋ฝธ๋พ”๋พฐ๋ฟŒ๋ฟจ์€„์€ ์€ผ์˜์ด์‚์‚ฌ์ƒˆ์ƒค์„€์„œ์„ธ์…”์…ฐ์†Œ์†จ์‡„์‡ ์‡ผ์ˆ˜์ˆด์‰์‰ฌ์Šˆ์Šค์‹€์‹œ์‹ธ์Œ”์Œฐ์Œ์จ์Ž„์Ž ์Žผ์˜์ด์์ฌ์‘ˆ์‘ค์’€์’œ์’ธ์“”์“ฐ์”Œ์”จ์•„์• ์•ผ์–˜์–ด์—์—ฌ์˜ˆ์˜ค์™€์™œ์™ธ์š”์šฐ์›Œ์›จ์œ„์œ ์œผ์˜์ด์ž์žฌ์Ÿˆ์Ÿค์ €์ œ์ ธ์ก”์กฐ์ขŒ์ขจ์ฃ„์ฃ ์ฃผ์ค˜์คด์ฅ์ฅฌ์ฆˆ์ฆค์ง€์งœ์งธ์จ”์จฐ์ฉŒ์ฉจ์ช„์ช ์ชผ์ซ˜์ซด์ฌ์ฌฌ์ญˆ์ญค์ฎ€์ฎœ์ฎธ์ฏ”์ฏฐ์ฐŒ์ฐจ์ฑ„์ฑ ์ฑผ์ฒ˜์ฒด์ณ์ณฌ์ดˆ์ดค์ต€์ตœ์ตธ์ถ”์ถฐ์ทŒ์ทจ์ธ„์ธ ์ธผ์น˜์นด์บ์บฌ์ปˆ์ปค์ผ€์ผœ์ผธ์ฝ”์ฝฐ์พŒ์พจ์ฟ„์ฟ ์ฟผํ€˜ํ€ดํํฌํ‚ˆํ‚คํƒ€ํƒœํƒธํ„”ํ„ฐํ…Œํ…จํ†„ํ† ํ†ผํ‡˜ํ‡ดํˆํˆฌํ‰ˆํ‰คํŠ€ํŠœํŠธํ‹”ํ‹ฐํŒŒํŒจํ„ํ ํผํŽ˜ํŽดํํฌํˆํคํ‘€ํ‘œํ‘ธํ’”ํ’ฐํ“Œํ“จํ”„ํ” ํ”ผํ•˜ํ•ดํ–ํ–ฌํ—ˆํ—คํ˜€ํ˜œํ˜ธํ™”ํ™ฐํšŒํšจํ›„ํ› ํ›ผํœ˜ํœดํํฌํžˆ]?[แ… -แ†ข]+|[๊ฐ€-ํžฃ])[แ†จ-แ‡น]*|[แ„€-แ…Ÿ]+|[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}])[\p{Mn}\p{Me}\x{09BE}\x{09D7}\x{0B3E}\x{0B57}\x{0BBE}\x{0BD7}\x{0CC2}\x{0CD5}\x{0CD6}\x{0D3E}\x{0D57}\x{0DCF}\x{0DDF}\x{200C}\x{200D}\x{1D165}\x{1D16E}-\x{1D172}]*|[\p{Cc}\p{Cf}\p{Zl}\p{Zp}])
    
    int(1)
    int(4)
    int(1)
    int(4)
    
    opened by Luc45 6
  • mb_convert_encoding($x, $y, 'HTML-ENTITIES') not functionally equivalent

    mb_convert_encoding($x, $y, 'HTML-ENTITIES') not functionally equivalent

    When calling mb_convert_encoding() with $fromEncoding === 'HTML-ENTITIES', the polyfill does not return functionally equivalent strings to the native function. This is because mb_convert_encoding() uses html_entity_decode() when $fromEncoding === 'HTML-ENTITIES' and that function does not return characters for many numeric entities 0-31 and 127-159. For example:

    <?php
    
    require "vendor/symfony/polyfill-mbstring/Mbstring.php";
    
    use Symfony\Polyfill\Mbstring as p;
    
    for($i = 0; $i < 1024; $i++) {
    	$string = "&#" . $i . ";";
    	$mbstring = mb_convert_encoding($string, 'UTF-8', 'HTML-ENTITIES');
    	$polyfill = p\Mbstring::mb_convert_encoding($string, 'UTF-8', 'HTML-ENTITIES');
    	if($mbstring != $polyfill) {
    		echo "Mismatch: $string - mbstring: $mbstring; polyfill: $polyfill\n";
    	}
    }
    

    outputs:

    Mismatch: &#0; - mbstring: ; polyfill: &#0;
    Mismatch: &#1; - mbstring: ; polyfill: &#1;
    Mismatch: &#2; - mbstring: ; polyfill: &#2;
    Mismatch: &#3; - mbstring: ; polyfill: &#3;
    Mismatch: &#4; - mbstring: ; polyfill: &#4;
    Mismatch: &#5; - mbstring: ; polyfill: &#5;
    Mismatch: &#6; - mbstring: ; polyfill: &#6;
    Mismatch: &#7; - mbstring: ; polyfill: &#7;
    Mismatch: &#8; - mbstring:; polyfill: &#8;
    Mismatch: &#11; - mbstring:
                                ; polyfill: &#11;
    Mismatch: &#12; - mbstring:
                                ; polyfill: &#12;
    Mismatch: &#14; - mbstring: ; polyfill: &#14;
    Mismatch: &#15; - mbstring: ; polyfill: &#15;
    Mismatch: &#16; - mbstring: ; polyfill: &#16;
    Mismatch: &#17; - mbstring: ; polyfill: &#17;
    Mismatch: &#18; - mbstring: ; polyfill: &#18;
    Mismatch: &#19; - mbstring: ; polyfill: &#19;
    Mismatch: &#20; - mbstring: ; polyfill: &#20;
    Mismatch: &#21; - mbstring: ; polyfill: &#21;
    Mismatch: &#22; - mbstring: ; polyfill: &#22;
    Mismatch: &#23; - mbstring: ; polyfill: &#23;
    Mismatch: &#24; - mbstring: ; polyfill: &#24;
    Mismatch: &#25; - mbstring: ; polyfill: &#25;
    Mismatch: &#26; - mbstring: ; polyfill: &#26;
    Mismatch: &#27; - mbstring:  polyfill: &#27;
    Mismatch: &#28; - mbstring: ; polyfill: &#28;
    Mismatch: &#29; - mbstring: ; polyfill: &#29;
    Mismatch: &#30; - mbstring: ; polyfill: &#30;
    Mismatch: &#31; - mbstring: ; polyfill: &#31;
    Mismatch: &#39; - mbstring: '; polyfill: &#39;
    Mismatch: &#127; - mbstring: ; polyfill: &#127;
    Mismatch: &#128; - mbstring: ย€; polyfill: &#128;
    Mismatch: &#129; - mbstring: ย; polyfill: &#129;
    Mismatch: &#130; - mbstring: ย‚; polyfill: &#130;
    Mismatch: &#131; - mbstring: ยƒ; polyfill: &#131;
    Mismatch: &#132; - mbstring: ย„; polyfill: &#132;
    Mismatch: &#133; - mbstring: ย…; polyfill: &#133;
    Mismatch: &#134; - mbstring: ย†; polyfill: &#134;
    Mismatch: &#135; - mbstring: ย‡; polyfill: &#135;
    Mismatch: &#136; - mbstring: ยˆ; polyfill: &#136;
    Mismatch: &#137; - mbstring: ย‰; polyfill: &#137;
    Mismatch: &#138; - mbstring: ยŠ; polyfill: &#138;
    Mismatch: &#139; - mbstring: ย‹; polyfill: &#139;
    Mismatch: &#140; - mbstring: ยŒ; polyfill: &#140;
    Mismatch: &#141; - mbstring: ย; polyfill: &#141;
    Mismatch: &#142; - mbstring: ยŽ; polyfill: &#142;
    Mismatch: &#143; - mbstring: ย; polyfill: &#143;
    Mismatch: &#144; - mbstring: ย; polyfill: &#144;
    Mismatch: &#145; - mbstring: ย‘; polyfill: &#145;
    Mismatch: &#146; - mbstring: ย’; polyfill: &#146;
    Mismatch: &#147; - mbstring: ย“; polyfill: &#147;
    Mismatch: &#148; - mbstring: ย”; polyfill: &#148;
    Mismatch: &#149; - mbstring: ย•; polyfill: &#149;
    Mismatch: &#150; - mbstring: ย–; polyfill: &#150;
    Mismatch: &#151; - mbstring: ย—; polyfill: &#151;
    Mismatch: &#152; - mbstring: ย˜; polyfill: &#152;
    Mismatch: &#153; - mbstring: ย™; polyfill: &#153;
    Mismatch: &#154; - mbstring: ยš; polyfill: &#154;
    Mismatch: &#155; - mbstring: ย›; polyfill: &#155;
    Mismatch: &#156; - mbstring: ยœ; polyfill: &#156;
    Mismatch: &#157; - mbstring: ย; polyfill: &#157;
    Mismatch: &#158; - mbstring: ยž; polyfill: &#158;
    Mismatch: &#159; - mbstring: ยŸ; polyfill: &#159;
    

    While many of these are control characters (and the native function does return them), the single quote (dec 39) is particularly problematic.

    opened by cpeel 1
YCOM Impersonate. Login as selected YCOM user ๐Ÿง™โ€โ™‚๏ธin frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Friends Of REDAXO 17 Sep 12, 2022
A Magento 2 dashboard to display installed extensions. Read the blog post on some of the thinking behind it:

Extension Dashboard for Magento 2 This module adds a dashboard to review all installed extensions in the Magento admin (Magento 2.3.0+ for now only).

ExtDN 36 Dec 24, 2022
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 845 Dec 13, 2022
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 836 Jan 26, 2022
Here is the top 100 PHP functions: it is the list of the most often used PHP native functions

Here is the top 100 PHP functions: it is the list of the most often used PHP native functions. If you are a PHP developer, you must know the Top 100 PHP Functions deeply.

Max Base 16 Dec 11, 2022
Dubbox now means Dubbo eXtensions, and it adds features like RESTful remoting, Kyro/FST serialization, etc to the Dubbo service framework.

Dubbox now means Dubbo eXtensions. If you know java, javax and dubbo, you know what dubbox is :) Dubbox adds features like RESTful remoting, Kyro/FST

ๅฝ“ๅฝ“ 4.9k Dec 27, 2022
this is a simple website about news and it has some features

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

a14z 2 Dec 11, 2022
Simple, modern looking server status page with administration and some nice features, that can run even on shared webhosting

Simple, modern looking server status page with administration and some nice features, that can run even on shared webhosting

Server status project 363 Dec 28, 2022
Magento-Functions - A Resource of Magento Functions

Magento-Functions A Resource of Magento Functions Table of Contents Category Product User Cart Checkout General Account [Working w/ URL's] (#urls) Cat

Bryan Littlefield 28 Apr 19, 2021
This package provides a simple and intuitive way to work on the Youtube Data API. It provides fluent interface to Youtube features.

Laravel Youtube Client This package provides a simple and intuitive way to work on the Youtube Data API. It provides fluent interface to Youtube featu

Tilson Mateus 6 May 31, 2023
Backwards compatibility Extension and Library for PHP 8.x and later

colopl_bc Provides various compatibility functions required for PHP (temporary) migration. WARNING This extension is intended for temporary use only.

COLOPL,Inc. 10 Jun 13, 2023
It is the latest version of private RAT called Xworm. I share this one for free, so leave the starโญ to this repository

XWorm-RAT-cracked- It is the latest version of private RAT called Xworm. I share this one for free, so leave the star โญ to this repository COMPILING:

null 67 Jan 1, 2023
PHP 7 Compatibility Checker

PHP 7 Compatibility Checker(php7cc) Project status The project is no longer supported. Please consider using one of the following alternatives: phan p

null 1.5k Dec 17, 2022
Silverstripe-sspy - Python based SSPAK export with higher reliability and cross-platform compatibility

SSPY - Python Stand-alone SSPAK solution ยฉ Simon Firesphere Erkelens; Moss Mossman Cantwell Usage: sspy [create|load|extract] (db|assets) --file=my.

Simon Erkelens 1 Jun 29, 2021
The tool converts different error reporting standards for deep compatibility with popular CI systems (TeamCity, IntelliJ IDEA, GitHub Actions, etc).

JBZoo / CI-Report-Converter Why? Installing Using as GitHub Action Example GitHub Action workflow Available Directions Help description in terminal Co

JBZoo Toolbox 17 Jun 16, 2022
Laravel Plans is a package for SaaS apps that need management over plans, features, subscriptions, events for plans or limited, countable features.

Laravel Plans Laravel Plans is a package for SaaS apps that need management over plans, features, subscriptions, events for plans or limited, countabl

รกngel 2 Oct 2, 2022
[READ-ONLY] CakePHP Utility classes such as Inflector, Text, Hash, Security and Xml. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

CakePHP Utility Classes This library provides a range of utility classes that are used throughout the CakePHP framework What's in the toolbox? Hash A

CakePHP 112 Feb 15, 2022
Hi Im L, I found a box that I believe it's contain Kira's real ID. for open that box we need to find three keys. let's start looking for them

DeathNote ctf Description are you smart enaugh to help me capturing the three keys for open the box that contain the real ID of kira? Let's start solv

Hamza Elansari 4 Nov 28, 2022
Magento 2 Module Experius Page Not Found 404. This module saves all 404 url to a database table

Magento 2 Module Experius Page Not Found 404 This module saves all 404 urls to a database table. Adds an admin grid with 404s It includes a count so y

Experius 28 Dec 9, 2022