"favicon",
"ico"
],
+ "support": {
+ "issues": "https://github.com/chrisbliss18/php-ico/issues",
+ "source": "https://github.com/chrisbliss18/php-ico"
+ },
"time": "2016-09-27T22:00:56+00:00"
},
{
"markdown",
"parser"
],
+ "support": {
+ "issues": "https://github.com/erusev/parsedown/issues",
+ "source": "https://github.com/erusev/parsedown/tree/1.7.x"
+ },
"time": "2019-12-30T22:54:17+00:00"
},
{
"keywords": [
"html"
],
+ "support": {
+ "issues": "https://github.com/ezyang/htmlpurifier/issues",
+ "source": "https://github.com/ezyang/htmlpurifier/tree/master"
+ },
"time": "2020-06-29T00:56:53+00:00"
},
{
"rest",
"web service"
],
+ "support": {
+ "issues": "https://github.com/guzzle/guzzle/issues",
+ "source": "https://github.com/guzzle/guzzle/tree/7.2.0"
+ },
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"keywords": [
"promise"
],
+ "support": {
+ "issues": "https://github.com/guzzle/promises/issues",
+ "source": "https://github.com/guzzle/promises/tree/1.4.0"
+ },
"time": "2020-09-30T07:37:28+00:00"
},
{
"uri",
"url"
],
+ "support": {
+ "issues": "https://github.com/guzzle/psr7/issues",
+ "source": "https://github.com/guzzle/psr7/tree/1.7.0"
+ },
"time": "2020-09-30T07:37:11+00:00"
},
{
"name": "paragonie/constant_time_encoding",
- "version": "v2.3.0",
+ "version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/constant_time_encoding.git",
- "reference": "47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2"
+ "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2",
- "reference": "47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2",
+ "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c",
+ "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c",
"shasum": ""
},
"require": {
"php": "^7|^8"
},
"require-dev": {
- "phpunit/phpunit": "^6|^7",
- "vimeo/psalm": "^1|^2|^3"
+ "phpunit/phpunit": "^6|^7|^8|^9",
+ "vimeo/psalm": "^1|^2|^3|^4"
},
"type": "library",
"autoload": {
"issues": "https://github.com/paragonie/constant_time_encoding/issues",
"source": "https://github.com/paragonie/constant_time_encoding"
},
- "time": "2019-11-06T19:20:29+00:00"
+ "time": "2020-12-06T15:14:20+00:00"
},
{
"name": "pear/net_idna2",
}
],
"description": "More info available on: https://pear.php.net/package/Net_IDNA2",
+ "support": {
+ "issues": "https://pear.php.net/bugs/search.php?cmd=display&package_name[]=Net_IDNA2",
+ "source": "https://github.com/pear/Net_IDNA2"
+ },
"time": "2017-03-06T20:46:41+00:00"
},
{
"keywords": [
"exception"
],
+ "support": {
+ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR_Exception",
+ "source": "https://github.com/pear/PEAR_Exception"
+ },
"time": "2019-12-10T10:24:42+00:00"
},
{
"psr",
"psr-18"
],
+ "support": {
+ "source": "https://github.com/php-fig/http-client/tree/master"
+ },
"time": "2020-06-29T06:28:15+00:00"
},
{
"request",
"response"
],
+ "support": {
+ "source": "https://github.com/php-fig/http-message/tree/master"
+ },
"time": "2016-08-06T14:39:51+00:00"
},
{
}
],
"description": "A polyfill for getallheaders.",
+ "support": {
+ "issues": "https://github.com/ralouphie/getallheaders/issues",
+ "source": "https://github.com/ralouphie/getallheaders/tree/develop"
+ },
"time": "2019-03-08T08:55:37+00:00"
},
{
},
{
"name": "symfony/css-selector",
- "version": "v4.4.15",
+ "version": "v5.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
- "reference": "bf17dc9f6ce144e41f786c32435feea4d8e11dcc"
+ "reference": "f65f217b3314504a1ec99c2d6ef69016bb13490f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/css-selector/zipball/bf17dc9f6ce144e41f786c32435feea4d8e11dcc",
- "reference": "bf17dc9f6ce144e41f786c32435feea4d8e11dcc",
+ "url": "https://api.github.com/repos/symfony/css-selector/zipball/f65f217b3314504a1ec99c2d6ef69016bb13490f",
+ "reference": "f65f217b3314504a1ec99c2d6ef69016bb13490f",
"shasum": ""
},
"require": {
- "php": ">=7.1.3"
+ "php": ">=7.2.5"
},
"type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- },
"autoload": {
"psr-4": {
"Symfony\\Component\\CssSelector\\": ""
"homepage": "https://symfony.com/contributors"
}
],
- "description": "Symfony CssSelector Component",
+ "description": "Converts CSS selectors to XPath expressions",
"homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/css-selector/tree/v5.2.2"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "tidelift"
}
],
- "time": "2020-07-05T09:39:30+00:00"
+ "time": "2021-01-27T10:01:46+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.18.1",
+ "version": "v1.22.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
+ "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
- "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13",
+ "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.1"
},
"suggest": {
"ext-mbstring": "For best performance"
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.18-dev"
+ "dev-main": "1.22-dev"
},
"thanks": {
"name": "symfony/polyfill",
"portable",
"shim"
],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "tidelift"
}
],
- "time": "2020-07-14T12:35:20+00:00"
+ "time": "2021-01-07T16:49:33+00:00"
},
{
"name": "true/punycode",
"idna",
"punycode"
],
+ "support": {
+ "issues": "https://github.com/true/php-punycode/issues",
+ "source": "https://github.com/true/php-punycode/tree/master"
+ },
"time": "2016-11-16T10:37:54+00:00"
}
],
),
'paragonie/constant_time_encoding' =>
array (
- 'pretty_version' => 'v2.3.0',
- 'version' => '2.3.0.0',
+ 'pretty_version' => 'v2.4.0',
+ 'version' => '2.4.0.0',
'aliases' =>
array (
),
- 'reference' => '47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2',
+ 'reference' => 'f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c',
),
'pear/net_idna2' =>
array (
),
'symfony/css-selector' =>
array (
- 'pretty_version' => 'v4.4.15',
- 'version' => '4.4.15.0',
+ 'pretty_version' => 'v5.2.2',
+ 'version' => '5.2.2.0',
'aliases' =>
array (
),
- 'reference' => 'bf17dc9f6ce144e41f786c32435feea4d8e11dcc',
+ 'reference' => 'f65f217b3314504a1ec99c2d6ef69016bb13490f',
),
'symfony/polyfill-mbstring' =>
array (
- 'pretty_version' => 'v1.18.1',
- 'version' => '1.18.1.0',
+ 'pretty_version' => 'v1.22.0',
+ 'version' => '1.22.0.0',
'aliases' =>
array (
),
- 'reference' => 'a6977d63bf9a0ad4c65cd352709e230876f9904a',
+ 'reference' => 'f377a3dd1fde44d37b9831d68dc8dea3ffd28e13',
),
'true/punycode' =>
array (
},
{
"name": "paragonie/constant_time_encoding",
- "version": "v2.3.0",
- "version_normalized": "2.3.0.0",
+ "version": "v2.4.0",
+ "version_normalized": "2.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/constant_time_encoding.git",
- "reference": "47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2"
+ "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2",
- "reference": "47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2",
+ "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c",
+ "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c",
"shasum": ""
},
"require": {
"php": "^7|^8"
},
"require-dev": {
- "phpunit/phpunit": "^6|^7",
- "vimeo/psalm": "^1|^2|^3"
+ "phpunit/phpunit": "^6|^7|^8|^9",
+ "vimeo/psalm": "^1|^2|^3|^4"
},
- "time": "2019-11-06T19:20:29+00:00",
+ "time": "2020-12-06T15:14:20+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
},
{
"name": "symfony/css-selector",
- "version": "v4.4.15",
- "version_normalized": "4.4.15.0",
+ "version": "v5.2.2",
+ "version_normalized": "5.2.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
- "reference": "bf17dc9f6ce144e41f786c32435feea4d8e11dcc"
+ "reference": "f65f217b3314504a1ec99c2d6ef69016bb13490f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/css-selector/zipball/bf17dc9f6ce144e41f786c32435feea4d8e11dcc",
- "reference": "bf17dc9f6ce144e41f786c32435feea4d8e11dcc",
+ "url": "https://api.github.com/repos/symfony/css-selector/zipball/f65f217b3314504a1ec99c2d6ef69016bb13490f",
+ "reference": "f65f217b3314504a1ec99c2d6ef69016bb13490f",
"shasum": ""
},
"require": {
- "php": ">=7.1.3"
+ "php": ">=7.2.5"
},
- "time": "2020-07-05T09:39:30+00:00",
+ "time": "2021-01-27T10:01:46+00:00",
"type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- },
"installation-source": "dist",
"autoload": {
"psr-4": {
"homepage": "https://symfony.com/contributors"
}
],
- "description": "Symfony CssSelector Component",
+ "description": "Converts CSS selectors to XPath expressions",
"homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/css-selector/tree/v5.2.2"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.18.1",
- "version_normalized": "1.18.1.0",
+ "version": "v1.22.0",
+ "version_normalized": "1.22.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
+ "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
- "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13",
+ "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.1"
},
"suggest": {
"ext-mbstring": "For best performance"
},
- "time": "2020-07-14T12:35:20+00:00",
+ "time": "2021-01-07T16:49:33+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.18-dev"
+ "dev-main": "1.22-dev"
},
"thanks": {
"name": "symfony/polyfill",
"portable",
"shim"
],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
),
'paragonie/constant_time_encoding' =>
array (
- 'pretty_version' => 'v2.3.0',
- 'version' => '2.3.0.0',
+ 'pretty_version' => 'v2.4.0',
+ 'version' => '2.4.0.0',
'aliases' =>
array (
),
- 'reference' => '47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2',
+ 'reference' => 'f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c',
),
'pear/net_idna2' =>
array (
),
'symfony/css-selector' =>
array (
- 'pretty_version' => 'v4.4.15',
- 'version' => '4.4.15.0',
+ 'pretty_version' => 'v5.2.2',
+ 'version' => '5.2.2.0',
'aliases' =>
array (
),
- 'reference' => 'bf17dc9f6ce144e41f786c32435feea4d8e11dcc',
+ 'reference' => 'f65f217b3314504a1ec99c2d6ef69016bb13490f',
),
'symfony/polyfill-mbstring' =>
array (
- 'pretty_version' => 'v1.18.1',
- 'version' => '1.18.1.0',
+ 'pretty_version' => 'v1.22.0',
+ 'version' => '1.22.0.0',
'aliases' =>
array (
),
- 'reference' => 'a6977d63bf9a0ad4c65cd352709e230876f9904a',
+ 'reference' => 'f377a3dd1fde44d37b9831d68dc8dea3ffd28e13',
),
'true/punycode' =>
array (
matrix:
fast_finish: true
include:
- - php: "7.0"
- php: "7.1"
- php: "7.2"
- php: "7.3"
- - php: "7.4snapshot"
+ - php: "7.4"
+ - php: "8.0"
- php: "nightly"
allow_failures:
- php: "nightly"
- - php: "7.4snapshot"
+ - php: "7.4"
+ - php: "8.0"
install:
- composer self-update
The MIT License (MIT)
-Copyright (c) 2016 - 2018 Paragon Initiative Enterprises
+Copyright (c) 2016 - 2020 Paragon Initiative Enterprises
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
"php": "^7|^8"
},
"require-dev": {
- "phpunit/phpunit": "^6|^7",
- "vimeo/psalm": "^1|^2|^3"
+ "phpunit/phpunit": "^6|^7|^8|^9",
+ "vimeo/psalm": "^1|^2|^3|^4"
},
"autoload": {
"psr-4": {
<?xml version="1.0" encoding="UTF-8"?>
-<phpunit backupGlobals="true"
- backupStaticAttributes="false"
- bootstrap="vendor/autoload.php"
- colors="true"
- convertErrorsToExceptions="true"
- convertNoticesToExceptions="true"
- convertWarningsToExceptions="true"
- processIsolation="false"
- stopOnError="false"
- stopOnFailure="false"
->
- <testsuites>
- <testsuite name="Constant Time Encoding Test Suite">
- <directory suffix="Test.php">./tests</directory>
- </testsuite>
- </testsuites>
- <filter>
- <whitelist processUncoveredFilesFromWhitelist="true">
- <directory suffix=".php">./src</directory>
- </whitelist>
- </filter>
-</phpunit>
\ No newline at end of file
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="true" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnError="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
+ <coverage processUncoveredFiles="true">
+ <include>
+ <directory suffix=".php">./src</directory>
+ </include>
+ </coverage>
+ <testsuites>
+ <testsuite name="Constant Time Encoding Test Suite">
+ <directory suffix="Test.php">./tests</directory>
+ </testsuite>
+ </testsuites>
+</phpunit>
/**
* Decode a Base32-encoded string into raw binary
*
- * @param string $src
+ * @param string $encodedString
+ * @param bool $strictPadding
* @return string
- * @throws \TypeError
*/
- public static function decode(string $src, bool $strictPadding = false): string
+ public static function decode(string $encodedString, bool $strictPadding = false): string
{
- return static::doDecode($src, false, $strictPadding);
+ return static::doDecode($encodedString, false, $strictPadding);
}
/**
* Decode an uppercase Base32-encoded string into raw binary
*
* @param string $src
+ * @param bool $strictPadding
* @return string
- * @throws \TypeError
*/
public static function decodeUpper(string $src, bool $strictPadding = false): string
{
*
* Base64 character set "./[A-Z][a-z][0-9]"
*
- * @param string $src
+ * @param string $encodedString
* @param bool $strictPadding
* @return string
* @throws \RangeException
* @throws \TypeError
* @psalm-suppress RedundantCondition
*/
- public static function decode(string $src, bool $strictPadding = false): string
+ public static function decode(string $encodedString, bool $strictPadding = false): string
{
// Remove padding
- $srcLen = Binary::safeStrlen($src);
+ $srcLen = Binary::safeStrlen($encodedString);
if ($srcLen === 0) {
return '';
}
if ($strictPadding) {
if (($srcLen & 3) === 0) {
- if ($src[$srcLen - 1] === '=') {
+ if ($encodedString[$srcLen - 1] === '=') {
$srcLen--;
- if ($src[$srcLen - 1] === '=') {
+ if ($encodedString[$srcLen - 1] === '=') {
$srcLen--;
}
}
'Incorrect padding'
);
}
- if ($src[$srcLen - 1] === '=') {
+ if ($encodedString[$srcLen - 1] === '=') {
throw new \RangeException(
'Incorrect padding'
);
}
} else {
- $src = \rtrim($src, '=');
- $srcLen = Binary::safeStrlen($src);
+ $encodedString = \rtrim($encodedString, '=');
+ $srcLen = Binary::safeStrlen($encodedString);
}
$err = 0;
// Main loop (no padding):
for ($i = 0; $i + 4 <= $srcLen; $i += 4) {
/** @var array<int, int> $chunk */
- $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 4));
+ $chunk = \unpack('C*', Binary::safeSubstr($encodedString, $i, 4));
$c0 = static::decode6Bits($chunk[1]);
$c1 = static::decode6Bits($chunk[2]);
$c2 = static::decode6Bits($chunk[3]);
// The last chunk, which may have padding:
if ($i < $srcLen) {
/** @var array<int, int> $chunk */
- $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i));
+ $chunk = \unpack('C*', Binary::safeSubstr($encodedString, $i, $srcLen - $i));
$c0 = static::decode6Bits($chunk[1]);
if ($i + 2 < $srcLen) {
if (\function_exists('mb_strlen')) {
return (int) \mb_strlen($str, '8bit');
} else {
- return (int) \strlen($str);
+ return \strlen($str);
}
}
* Convert a hexadecimal string into a binary string without cache-timing
* leaks
*
- * @param string $hexString
+ * @param string $encodedString
* @param bool $strictPadding
* @return string (raw binary)
* @throws \RangeException
*/
- public static function decode(string $hexString, bool $strictPadding = false): string
+ public static function decode(string $encodedString, bool $strictPadding = false): string
{
/** @var int $hex_pos */
$hex_pos = 0;
/** @var int $c_acc */
$c_acc = 0;
/** @var int $hex_len */
- $hex_len = Binary::safeStrlen($hexString);
+ $hex_len = Binary::safeStrlen($encodedString);
/** @var int $state */
$state = 0;
if (($hex_len & 1) !== 0) {
'Expected an even number of hexadecimal characters'
);
} else {
- $hexString = '0' . $hexString;
+ $encodedString = '0' . $encodedString;
++$hex_len;
}
}
/** @var array<int, int> $chunk */
- $chunk = \unpack('C*', $hexString);
+ $chunk = \unpack('C*', $encodedString);
while ($hex_pos < $hex_len) {
++$hex_pos;
/** @var int $c */
if (($c_num0 | $c_alpha0) === 0) {
throw new \RangeException(
- 'hexEncode() only expects hexadecimal characters'
+ 'Expected hexadecimal character'
);
}
/** @var int $c_val */
class CssSelectorConverter
{
private $translator;
+ private $cache;
+
+ private static $xmlCache = [];
+ private static $htmlCache = [];
/**
* @param bool $html Whether HTML support should be enabled. Disable it for XML documents
if ($html) {
$this->translator->registerExtension(new HtmlExtension($this->translator));
+ $this->cache = &self::$htmlCache;
+ } else {
+ $this->cache = &self::$xmlCache;
}
$this->translator
* Optionally, a prefix can be added to the resulting XPath
* expression with the $prefix parameter.
*
- * @param string $cssExpr The CSS expression
- * @param string $prefix An optional prefix for the XPath expression
- *
* @return string
*/
- public function toXPath($cssExpr, $prefix = 'descendant-or-self::')
+ public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::')
{
- return $this->translator->cssToXPath($cssExpr, $prefix);
+ return $this->cache[$prefix][$cssExpr] ?? $this->cache[$prefix][$cssExpr] = $this->translator->cssToXPath($cssExpr, $prefix);
}
}
class SyntaxErrorException extends ParseException
{
/**
- * @param string $expectedValue
- *
* @return self
*/
- public static function unexpectedToken($expectedValue, Token $foundToken)
+ public static function unexpectedToken(string $expectedValue, Token $foundToken)
{
return new self(sprintf('Expected %s, but %s found.', $expectedValue, $foundToken));
}
/**
- * @param string $pseudoElement
- * @param string $unexpectedLocation
- *
* @return self
*/
- public static function pseudoElementFound($pseudoElement, $unexpectedLocation)
+ public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation)
{
return new self(sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation));
}
/**
- * @param int $position
- *
* @return self
*/
- public static function unclosedString($position)
+ public static function unclosedString(int $position)
{
return new self(sprintf('Unclosed/invalid string at %s.', $position));
}
-Copyright (c) 2004-2020 Fabien Potencier
+Copyright (c) 2004-2021 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
*/
class Specificity
{
- const A_FACTOR = 100;
- const B_FACTOR = 10;
- const C_FACTOR = 1;
+ public const A_FACTOR = 100;
+ public const B_FACTOR = 10;
+ public const C_FACTOR = 1;
private $a;
private $b;
}
$split = explode('n', $joined);
- $first = isset($split[0]) ? $split[0] : null;
+ $first = $split[0] ?? null;
return [
$first ? ('-' === $first || '+' === $first ? $int($first.'1') : $int($first)) : 1,
private function parserSelectorNode(TokenStream $stream): Node\SelectorNode
{
- list($result, $pseudoElement) = $this->parseSimpleSelector($stream);
+ [$result, $pseudoElement] = $this->parseSimpleSelector($stream);
while (true) {
$stream->skipWhitespace();
$combinator = ' ';
}
- list($nextSelector, $pseudoElement) = $this->parseSimpleSelector($stream);
+ [$nextSelector, $pseudoElement] = $this->parseSimpleSelector($stream);
$result = new Node\CombinedSelectorNode($result, $combinator, $nextSelector);
}
throw SyntaxErrorException::nestedNot();
}
- list($argument, $argumentPseudoElement) = $this->parseSimpleSelector($stream, true);
+ [$argument, $argumentPseudoElement] = $this->parseSimpleSelector($stream, true);
$next = $stream->getNext();
if (null !== $argumentPseudoElement) {
*/
class Token
{
- const TYPE_FILE_END = 'eof';
- const TYPE_DELIMITER = 'delimiter';
- const TYPE_WHITESPACE = 'whitespace';
- const TYPE_IDENTIFIER = 'identifier';
- const TYPE_HASH = 'hash';
- const TYPE_NUMBER = 'number';
- const TYPE_STRING = 'string';
+ public const TYPE_FILE_END = 'eof';
+ public const TYPE_DELIMITER = 'delimiter';
+ public const TYPE_WHITESPACE = 'whitespace';
+ public const TYPE_IDENTIFIER = 'identifier';
+ public const TYPE_HASH = 'hash';
+ public const TYPE_NUMBER = 'number';
+ public const TYPE_STRING = 'string';
private $type;
private $value;
public function translateNthChild(XPathExpr $xpath, FunctionNode $function, bool $last = false, bool $addNameTest = true): XPathExpr
{
try {
- list($a, $b) = Parser::parseSeries($function->getArguments());
+ [$a, $b] = Parser::parseSeries($function->getArguments());
} catch (SyntaxErrorException $e) {
throw new ExpressionErrorException(sprintf('Invalid series: "%s".', implode('", "', $function->getArguments())), 0, $e);
}
*/
class NodeExtension extends AbstractExtension
{
- const ELEMENT_NAME_IN_LOWER_CASE = 1;
- const ATTRIBUTE_NAME_IN_LOWER_CASE = 2;
- const ATTRIBUTE_VALUE_IN_LOWER_CASE = 4;
+ public const ELEMENT_NAME_IN_LOWER_CASE = 1;
+ public const ATTRIBUTE_NAME_IN_LOWER_CASE = 2;
+ public const ATTRIBUTE_VALUE_IN_LOWER_CASE = 4;
private $flags;
{
"name": "symfony/css-selector",
"type": "library",
- "description": "Symfony CssSelector Component",
+ "description": "Converts CSS selectors to XPath expressions",
"keywords": [],
"homepage": "https://symfony.com",
"license": "MIT",
}
],
"require": {
- "php": ">=7.1.3"
+ "php": ">=7.2.5"
},
"autoload": {
"psr-4": { "Symfony\\Component\\CssSelector\\": "" },
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
*/
final class Mbstring
{
- const MB_CASE_FOLD = PHP_INT_MAX;
+ public const MB_CASE_FOLD = \PHP_INT_MAX;
- private static $encodingList = array('ASCII', 'UTF-8');
+ private static $encodingList = ['ASCII', 'UTF-8'];
private static $language = 'neutral';
private static $internalEncoding = 'UTF-8';
- private static $caseFold = array(
- array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
- array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'),
- );
+ private static $caseFold = [
+ ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
+ ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'],
+ ];
public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
{
$s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
}
- return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
+ return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s);
}
if ('HTML-ENTITIES' === $fromEncoding) {
- $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
+ $s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8');
$fromEncoding = 'UTF-8';
}
return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
}
- public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
+ public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars)
{
- $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
-
$ok = true;
array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
- if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
+ if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
$ok = false;
}
});
public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
{
- trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
+ trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING);
}
public static function mb_decode_numericentity($s, $convmap, $encoding = null)
{
- if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
- trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
+ if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
+ trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
return null;
}
- if (!\is_array($convmap) || !$convmap) {
+ if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
return false;
}
- if (null !== $encoding && !\is_scalar($encoding)) {
- trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
+ if (null !== $encoding && !is_scalar($encoding)) {
+ trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
return ''; // Instead of null (cf. mb_encode_numericentity).
}
$c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
for ($i = 0; $i < $cnt; $i += 4) {
if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
- return Mbstring::mb_chr($c - $convmap[$i + 2]);
+ return self::mb_chr($c - $convmap[$i + 2]);
}
}
public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
{
- if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
- trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
+ if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
+ trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
return null;
}
- if (!\is_array($convmap) || !$convmap) {
+ if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
return false;
}
- if (null !== $encoding && !\is_scalar($encoding)) {
- trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
+ if (null !== $encoding && !is_scalar($encoding)) {
+ trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
return null; // Instead of '' (cf. mb_decode_numericentity).
}
- if (null !== $is_hex && !\is_scalar($is_hex)) {
- trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
+ if (null !== $is_hex && !is_scalar($is_hex)) {
+ trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING);
return null;
}
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
}
- static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
+ static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
$cnt = floor(\count($convmap) / 4) * 4;
$i = 0;
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
}
- if (MB_CASE_TITLE == $mode) {
+ if (\MB_CASE_TITLE == $mode) {
static $titleRegexp = null;
if (null === $titleRegexp) {
$titleRegexp = self::getData('titleCaseRegexp');
}
- $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
+ $s = preg_replace_callback($titleRegexp, [__CLASS__, 'title_case'], $s);
} else {
- if (MB_CASE_UPPER == $mode) {
+ if (\MB_CASE_UPPER == $mode) {
static $upper = null;
if (null === $upper) {
$upper = self::getData('upperCase');
$map = $lower;
}
- static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
+ static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
$i = 0;
$len = \strlen($s);
return self::$internalEncoding;
}
- $encoding = self::getEncoding($encoding);
+ $normalizedEncoding = self::getEncoding($encoding);
- if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
- self::$internalEncoding = $encoding;
+ if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) {
+ self::$internalEncoding = $normalizedEncoding;
return true;
}
- return false;
+ if (80000 > \PHP_VERSION_ID) {
+ return false;
+ }
+
+ throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding));
}
public static function mb_language($lang = null)
return self::$language;
}
- switch ($lang = strtolower($lang)) {
+ switch ($normalizedLang = strtolower($lang)) {
case 'uni':
case 'neutral':
- self::$language = $lang;
+ self::$language = $normalizedLang;
return true;
}
- return false;
+ if (80000 > \PHP_VERSION_ID) {
+ return false;
+ }
+
+ throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang));
}
public static function mb_list_encodings()
{
- return array('UTF-8');
+ return ['UTF-8'];
}
public static function mb_encoding_aliases($encoding)
switch (strtoupper($encoding)) {
case 'UTF8':
case 'UTF-8':
- return array('utf8');
+ return ['utf8'];
}
return false;
$encoding = self::$internalEncoding;
}
- return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
+ return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var);
}
public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
$needle = (string) $needle;
if ('' === $needle) {
- trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
+ if (80000 > \PHP_VERSION_ID) {
+ trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING);
- return false;
+ return false;
+ }
+
+ return 0;
}
return iconv_strpos($haystack, $needle, $offset, $encoding);
}
}
- $pos = iconv_strrpos($haystack, $needle, $encoding);
+ $pos = '' !== $needle || 80000 > \PHP_VERSION_ID
+ ? iconv_strrpos($haystack, $needle, $encoding)
+ : self::mb_strlen($haystack, $encoding);
return false !== $pos ? $offset + $pos : false;
}
public static function mb_str_split($string, $split_length = 1, $encoding = null)
{
- if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
- trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
+ if (null !== $string && !is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) {
+ trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING);
return null;
}
if (1 > $split_length = (int) $split_length) {
- trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
+ if (80000 > \PHP_VERSION_ID) {
+ trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING);
+ return false;
+ }
- return false;
+ throw new \ValueError('Argument #2 ($length) must be greater than 0');
}
if (null === $encoding) {
}
$rx .= '.{'.$split_length.'})/us';
- return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
+ return preg_split($rx, $string, null, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY);
}
- $result = array();
+ $result = [];
$length = mb_strlen($string, $encoding);
for ($i = 0; $i < $length; $i += $split_length) {
public static function mb_strtolower($s, $encoding = null)
{
- return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
+ return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding);
}
public static function mb_strtoupper($s, $encoding = null)
{
- return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
+ return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding);
}
public static function mb_substitute_character($c = null)
{
+ if (null === $c) {
+ return 'none';
+ }
if (0 === strcasecmp($c, 'none')) {
return true;
}
+ if (80000 > \PHP_VERSION_ID) {
+ return false;
+ }
- return null !== $c ? false : 'none';
+ throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint');
}
public static function mb_substr($s, $start, $length = null, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
- return strrchr($haystack, $needle, $part);
+ $pos = strrpos($haystack, $needle);
+ } else {
+ $needle = self::mb_substr($needle, 0, 1, $encoding);
+ $pos = iconv_strrpos($haystack, $needle, $encoding);
}
- $needle = self::mb_substr($needle, 0, 1, $encoding);
- $pos = iconv_strrpos($haystack, $needle, $encoding);
return self::getSubpart($pos, $part, $haystack, $encoding);
}
public static function mb_get_info($type = 'all')
{
- $info = array(
+ $info = [
'internal_encoding' => self::$internalEncoding,
'http_output' => 'pass',
'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
'detect_order' => self::$encodingList,
'substitute_character' => 'none',
'strict_detection' => 'Off',
- );
+ ];
if ('all' === $type) {
return $info;
{
$i = 1;
$entities = '';
- $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
+ $m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8'));
while (isset($m[$i])) {
if (0x80 > $m[$i]) {
private static function title_case(array $s)
{
- return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
+ return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8');
}
private static function getData($file)
use Symfony\Polyfill\Mbstring as p;
+if (\PHP_VERSION_ID >= 80000) {
+ return require __DIR__.'/bootstrap80.php';
+}
+
if (!function_exists('mb_convert_encoding')) {
- function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
+ function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); }
}
if (!function_exists('mb_decode_mimeheader')) {
- function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
+ function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); }
}
if (!function_exists('mb_encode_mimeheader')) {
- function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
+ function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); }
}
if (!function_exists('mb_decode_numericentity')) {
- function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
+ function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); }
}
if (!function_exists('mb_encode_numericentity')) {
- function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
+ function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); }
}
if (!function_exists('mb_convert_case')) {
- function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
+ function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); }
}
if (!function_exists('mb_internal_encoding')) {
- function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
+ function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); }
}
if (!function_exists('mb_language')) {
- function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
+ function mb_language($language = null) { return p\Mbstring::mb_language($language); }
}
if (!function_exists('mb_list_encodings')) {
function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
}
if (!function_exists('mb_check_encoding')) {
- function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
+ function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); }
}
if (!function_exists('mb_detect_encoding')) {
- function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
+ function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); }
}
if (!function_exists('mb_detect_order')) {
- function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
+ function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); }
}
if (!function_exists('mb_parse_str')) {
- function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
+ function mb_parse_str($string, &$result = []) { parse_str($string, $result); }
}
if (!function_exists('mb_strlen')) {
- function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
+ function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); }
}
if (!function_exists('mb_strpos')) {
- function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
+ function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('mb_strtolower')) {
- function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
+ function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); }
}
if (!function_exists('mb_strtoupper')) {
- function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
+ function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); }
}
if (!function_exists('mb_substitute_character')) {
- function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
+ function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); }
}
if (!function_exists('mb_substr')) {
- function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
+ function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); }
}
if (!function_exists('mb_stripos')) {
- function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
+ function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('mb_stristr')) {
- function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
+ function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); }
}
if (!function_exists('mb_strrchr')) {
- function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
+ function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); }
}
if (!function_exists('mb_strrichr')) {
- function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
+ function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); }
}
if (!function_exists('mb_strripos')) {
- function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
+ function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('mb_strrpos')) {
- function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
+ function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('mb_strstr')) {
- function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
+ function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); }
}
if (!function_exists('mb_get_info')) {
function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
}
if (!function_exists('mb_http_output')) {
- function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
+ function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); }
}
if (!function_exists('mb_strwidth')) {
- function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
+ function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); }
}
if (!function_exists('mb_substr_count')) {
- function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
+ function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); }
}
if (!function_exists('mb_output_handler')) {
- function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
+ function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); }
}
if (!function_exists('mb_http_input')) {
- function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
+ function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); }
}
+
if (!function_exists('mb_convert_variables')) {
- function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
+ function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); }
}
+
if (!function_exists('mb_ord')) {
- function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
+ function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); }
}
if (!function_exists('mb_chr')) {
- function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
+ function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); }
}
if (!function_exists('mb_scrub')) {
- function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
+ function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); }
}
if (!function_exists('mb_str_split')) {
- function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
+ function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); }
}
if (extension_loaded('mbstring')) {
--- /dev/null
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Symfony\Polyfill\Mbstring as p;
+
+if (!function_exists('mb_convert_encoding')) {
+ function mb_convert_encoding(array|string $string, string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); }
+}
+if (!function_exists('mb_decode_mimeheader')) {
+ function mb_decode_mimeheader(string $string): string { return p\Mbstring::mb_decode_mimeheader($string); }
+}
+if (!function_exists('mb_encode_mimeheader')) {
+ function mb_encode_mimeheader(string $string, string $charset = null, string $transfer_encoding = null, string $newline = "\r\n", int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); }
+}
+if (!function_exists('mb_decode_numericentity')) {
+ function mb_decode_numericentity(string $string, array $map, string $encoding = null): string { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); }
+}
+if (!function_exists('mb_encode_numericentity')) {
+ function mb_encode_numericentity(string $string, array $map, string $encoding = null, bool $hex = false): string { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); }
+}
+if (!function_exists('mb_convert_case')) {
+ function mb_convert_case(string $string, int $mode, string $encoding = null): string { return p\Mbstring::mb_convert_case($string, $mode, $encoding); }
+}
+if (!function_exists('mb_internal_encoding')) {
+ function mb_internal_encoding(string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); }
+}
+if (!function_exists('mb_language')) {
+ function mb_language(string $language = null): string|bool { return p\Mbstring::mb_language($language); }
+}
+if (!function_exists('mb_list_encodings')) {
+ function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); }
+}
+if (!function_exists('mb_encoding_aliases')) {
+ function mb_encoding_aliases(string $encoding): array { return p\Mbstring::mb_encoding_aliases($encoding); }
+}
+if (!function_exists('mb_check_encoding')) {
+ function mb_check_encoding(array|string|null $value = null, string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); }
+}
+if (!function_exists('mb_detect_encoding')) {
+ function mb_detect_encoding(string $string, array|string|null $encodings = null, bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); }
+}
+if (!function_exists('mb_detect_order')) {
+ function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); }
+}
+if (!function_exists('mb_parse_str')) {
+ function mb_parse_str(string $string, &$result = array()): bool { parse_str($string, $result); }
+}
+if (!function_exists('mb_strlen')) {
+ function mb_strlen(string $string, string $encoding = null): int { return p\Mbstring::mb_strlen($string, $encoding); }
+}
+if (!function_exists('mb_strpos')) {
+ function mb_strpos(string $haystack, string $needle, int $offset = 0, string $encoding = null): int|false { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); }
+}
+if (!function_exists('mb_strtolower')) {
+ function mb_strtolower(string $string, string $encoding = null): string { return p\Mbstring::mb_strtolower($string, $encoding); }
+}
+if (!function_exists('mb_strtoupper')) {
+ function mb_strtoupper(string $string, string $encoding = null): string { return p\Mbstring::mb_strtoupper($string, $encoding); }
+}
+if (!function_exists('mb_substitute_character')) {
+ function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); }
+}
+if (!function_exists('mb_substr')) {
+ function mb_substr(string $string, int $start, int $length = null, string $encoding = null): string { return p\Mbstring::mb_substr($string, $start, $length, $encoding); }
+}
+if (!function_exists('mb_stripos')) {
+ function mb_stripos(string $haystack, string $needle, int $offset = 0, string $encoding = null): int|false { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); }
+}
+if (!function_exists('mb_stristr')) {
+ function mb_stristr(string $haystack, string $needle, bool $before_needle = false, string $encoding = null): string|false { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); }
+}
+if (!function_exists('mb_strrchr')) {
+ function mb_strrchr(string $haystack, string $needle, bool $before_needle = false, string $encoding = null): string|false { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); }
+}
+if (!function_exists('mb_strrichr')) {
+ function mb_strrichr(string $haystack, string $needle, bool $before_needle = false, string $encoding = null): string|false { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); }
+}
+if (!function_exists('mb_strripos')) {
+ function mb_strripos(string $haystack, string $needle, int $offset = 0, string $encoding = null): int|false { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); }
+}
+if (!function_exists('mb_strrpos')) {
+ function mb_strrpos(string $haystack, string $needle, int $offset = 0, string $encoding = null): int|false { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); }
+}
+if (!function_exists('mb_strstr')) {
+ function mb_strstr(string $haystack, string $needle, bool $before_needle = false, string $encoding = null): string|false { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); }
+}
+if (!function_exists('mb_get_info')) {
+ function mb_get_info(string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info($type); }
+}
+if (!function_exists('mb_http_output')) {
+ function mb_http_output(string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); }
+}
+if (!function_exists('mb_strwidth')) {
+ function mb_strwidth(string $string, string $encoding = null): int { return p\Mbstring::mb_strwidth($string, $encoding); }
+}
+if (!function_exists('mb_substr_count')) {
+ function mb_substr_count(string $haystack, string $needle, string $encoding = null): int { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); }
+}
+if (!function_exists('mb_output_handler')) {
+ function mb_output_handler(string $string, int $status): string { return p\Mbstring::mb_output_handler($string, $status); }
+}
+if (!function_exists('mb_http_input')) {
+ function mb_http_input(string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); }
+}
+
+if (!function_exists('mb_convert_variables')) {
+ function mb_convert_variables(string $to_encoding, array|string $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, $var, ...$vars); }
+}
+
+if (!function_exists('mb_ord')) {
+ function mb_ord(string $string, string $encoding = null): int|false { return p\Mbstring::mb_ord($string, $encoding); }
+}
+if (!function_exists('mb_chr')) {
+ function mb_chr(int $codepoint, string $encoding = null): string|false { return p\Mbstring::mb_chr($codepoint, $encoding); }
+}
+if (!function_exists('mb_scrub')) {
+ function mb_scrub(string $string, string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding($string, $encoding, $encoding); }
+}
+if (!function_exists('mb_str_split')) {
+ function mb_str_split(string $string, int $length = 1, string $encoding = null): array { return p\Mbstring::mb_str_split($string, $length, $encoding); }
+}
+
+if (extension_loaded('mbstring')) {
+ return;
+}
+
+if (!defined('MB_CASE_UPPER')) {
+ define('MB_CASE_UPPER', 0);
+}
+if (!defined('MB_CASE_LOWER')) {
+ define('MB_CASE_LOWER', 1);
+}
+if (!defined('MB_CASE_TITLE')) {
+ define('MB_CASE_TITLE', 2);
+}
}
],
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.1"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" },
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.18-dev"
+ "dev-main": "1.22-dev"
},
"thanks": {
"name": "symfony/polyfill",