Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ For example you can write me a email: lars@moelleken.org

## Known vulnerabilities

Portable UTF-8 versions prior to 5.4.26 (released 2019-11-05) have an open redirect vulnerability. The `Bootup::filterRequestUri()` method used a unsecure `header('Location ...` implentation. And because it's most secure to not use this method at all, I decided to disable the function by default.
Portable UTF-8 versions prior to 5.4.26 (released 2019-11-05) have an open redirect vulnerability. The `Bootup::filterRequestUri()` method used an insecure `header('Location ...` implementation. And because it's most secure to not use this method at all, I decided to disable the function by default.
2 changes: 1 addition & 1 deletion build/docs/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ This removes any overhead from these polyfills as they are no longer part of you
}
```

## Why Portable UTF-8?[]()
## Why Portable UTF-8?
PHP 5 and earlier versions have no native Unicode support. To bridge the gap, there exist several extensions like "mbstring", "iconv" and "intl".

The problem with "mbstring" and others is that most of the time you cannot ensure presence of a specific one on a server. If you rely on one of these, your application is no more portable. This problem gets even severe for open source applications that have to run on different servers with different configurations. Considering these, I decided to write a library:
Expand Down
8 changes: 4 additions & 4 deletions src/voku/helper/UTF8.php
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@
*
* EXAMPLE: <code>UTF8::css_identifier('123foo/bar!!!'); // _23foo-bar</code>
*
* copy&past from https://github.com/drupal/core/blob/8.8.x/lib/Drupal/Component/Utility/Html.php#L95
* copy&paste from https://github.com/drupal/core/blob/8.8.x/lib/Drupal/Component/Utility/Html.php#L95
*
* @param string $str <p>INFO: if no identifier is given e.g. " " or "", we will create a unique string automatically</p>
* @param string[] $filter
Expand Down Expand Up @@ -3086,7 +3086,7 @@
}

/**
* Create a escape html version of the string via "UTF8::htmlspecialchars()".
* Create an escaped HTML version of the string via `UTF8::htmlspecialchars()`.
*
* @param string $str
* @param string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>
Expand Down Expand Up @@ -5303,7 +5303,7 @@
*
* EXAMPLE: <code>UTF8::remove_invisible_characters("κόσ\0με"); // 'κόσμε'</code>
*
* copy&past from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/Common.php
* copy&paste from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/Common.php
*
* @param string $str <p>The input string.</p>
* @param bool $url_encoded [optional] <p>
Expand Down Expand Up @@ -6964,11 +6964,11 @@

$encoding = self::normalize_encoding($encoding, 'UTF-8');

if ((int) self::strlen_in_byte($str, $encoding) <= $length) {

Check failure on line 6967 in src/voku/helper/UTF8.php

View workflow job for this annotation

GitHub Actions / tests (8, basic)

Static method voku\helper\UTF8::strlen_in_byte() invoked with 2 parameters, 1 required.
return $str;
}

return ((string) self::substr_in_byte($str, 0, $length - (int) self::strlen_in_byte($str_add_on), $encoding)) . $str_add_on;

Check failure on line 6971 in src/voku/helper/UTF8.php

View workflow job for this annotation

GitHub Actions / tests (8, basic)

Static method voku\helper\UTF8::substr_in_byte() invoked with 4 parameters, 1-3 required.
}

/**
Expand Down Expand Up @@ -9494,7 +9494,7 @@
\Normalizer::normalize($str2, \Normalizer::NFD)
);

if (!is_int($cmp)) {

Check failure on line 9497 in src/voku/helper/UTF8.php

View workflow job for this annotation

GitHub Actions / tests (8, basic)

Call to function is_int() with int<-1, 1> will always evaluate to true.
return $cmp < 0 ? -1 : ($cmp > 0 ? 1 : 0);
}

Expand Down Expand Up @@ -10272,7 +10272,7 @@
$needle = (string) $needle;

if ($haystack === '') {
if (\PHP_VERSION_ID >= 80000 && $needle === '') {

Check failure on line 10275 in src/voku/helper/UTF8.php

View workflow job for this annotation

GitHub Actions / tests (8, basic)

Comparison operation ">=" between int<80000, max> and 80000 is always true.
return 0;
}

Expand Down Expand Up @@ -10782,7 +10782,7 @@
$needle = (string) $needle;

if ($haystack === '') {
if (\PHP_VERSION_ID >= 80000 && $needle === '') {

Check failure on line 10785 in src/voku/helper/UTF8.php

View workflow job for this annotation

GitHub Actions / tests (8, basic)

Comparison operation ">=" between int<80000, max> and 80000 is always true.
return 0;
}

Expand Down Expand Up @@ -10954,7 +10954,7 @@
$needle = (string) $needle;

if ($haystack === '') {
if (\PHP_VERSION_ID >= 80000 && $needle === '') {

Check failure on line 10957 in src/voku/helper/UTF8.php

View workflow job for this annotation

GitHub Actions / tests (8, basic)

Comparison operation ">=" between int<80000, max> and 80000 is always true.
return 0;
}

Expand Down Expand Up @@ -13363,7 +13363,7 @@
*
* @param string $str <p>The input string.</p>
* @param int<1, max> $limit <p>The limit of words as integer.</p>
* @param string $str_add_on <p>Replacement for the striped string.</p>
* @param string $str_add_on <p>Replacement for the stripped string.</p>
*
* @psalm-pure
*
Expand Down
Loading