add intl package for Normalizer class

This commit is contained in:
Spine committed 2026-08-16 00:16:44 +02:00
1 parent ab8ef58129
commit abc73642c1
9 files changed
+100 -95

No files matched your search

+1
View File
@@ -38,6 +38,7 @@ RUN apt-get update \
php${PHP_VER}-fpm \
php${PHP_VER}-gd \
php${PHP_VER}-iconv \
php${PHP_VER}-intl \
php${PHP_VER}-mbstring \
php${PHP_VER}-memcached \
php${PHP_VER}-mysql \
+4 -27
View File
@@ -7,7 +7,7 @@ uses Mysql and Sphinx, but work is under way to replace those with
Postgresql.
## Gazelle Runtime Dependencies
* [PHP 8.4.13+](https://www.php.net/) (required)
* [PHP 8.5.9+](https://www.php.net/) (required)
* [PostgreSQL 17](https://www.postgresql.org/) (required)
* [MySQL 8.4](https://www.mysql.com/) (required)
* [nginx](http://wiki.nginx.org/Main) (required)
@@ -38,21 +38,6 @@ proxies, and tuning TCP configs to obtain proper performance and privacy.
Docker is used to develop Gazelle. See https://docs.docker.com/engine/install/
for more information on getting Docker set up locally.
### Docker on WSL
By default, Windows Subsystem for Linux (WSL) does not support the use of
`docker compose`. As root, you should to run the following command
```
apt-get install ca-certificates curl \
&& install -m 0755 -d /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
&& chmod a+r /etc/apt/keyrings/docker.asc \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
> /etc/apt/sources.list.d/docker.list \
&& apt-get update \
&& apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```
### Gazelle
In the root folder of the Gazelle repository, run the following command:
@@ -171,16 +156,6 @@ Similarly, the phpstan container can be built with
docker build -t gazelle-phpstan:latest -f misc/phpstan.Dockerfile --compress misc/docker
## Upgrading Postgresql
Major Pg versions require a dump and restore. In the docker environment
this means doing the following;
- run 'make pgdump' to dump the current contents
- stop the current postgresql container
- mv misc/docker/data/pg misc/docker/data/pg.old
- mkdir ./docker/data/pg
- docker compose stop && docker compose up -d
- import the dump to the docker pg container
## Contact and Discussion
Feel free to join #develop on irc.orpheus.network to discuss any
questions concerning Gazelle (or any of the repos published by
@@ -191,4 +166,6 @@ Run `bin/setup-git-hooks` once, to install a git precommit hook that will run li
checks on PHP, JS, Twig and CSS files at each commit.
Create issues at https://github.com/OPSnet
Patches welcome!
Patches welcome! AI not welcome, this application is crafted by hand and each
line is understood.
+34 -7
View File
@@ -1012,13 +1012,40 @@ class Artist extends BaseAttrObject implements Bookmarked, CollageEntry {
/* STATIC METHODS - for when you do not yet have an ID, e.g. during creation */
/**
* Collapse whitespace and directional markers, because people copypaste carelessly.
* TODO: make stricter, e.g. on all whitespace characters or Unicode normalisation
* Collapse whitespace and directional markers, renormalize Unicode,
* because it's a dangerous world out there.
*/
public static function sanitize(string $name): ?string {
// \u200e is ‎
$name = preg_replace('/^(?:\xE2\x80\x8E|\s)+/', '', $name);
$name = preg_replace('/(?:\xE2\x80\x8E|\s)+$/', '', $name);
return preg_replace('/ +/', ' ', $name);
public static function sanitize(string $name): string|null {
$name = preg_replace(
// directional markers
'/[\x{200e}\x{200f}\x{202a}-\x{202e}\x{2066}-\x{2069}]/u',
'',
trim($name),
);
$name = \Normalizer::normalize(
$name,
// u + combining diaeresis => latin small letter u with diaresis
\Normalizer::NFC,
);
if ($name === false) {
// encoded in wtf-8
return null;
}
$name = preg_replace(
// weirdo whitespace
'/[\s\x{00A0}\x{2000}-\x{200B}\x{202F}\x{205F}\x{3000}]/u',
' ',
$name,
);
if (!is_string($name)) {
return null;
}
$name = preg_replace(
// collapse whitespace
'/\s+/',
' ',
$name,
);
return is_string($name) ? $name : null;
}
}
Generated
+55 -56
View File
@@ -3559,20 +3559,20 @@
},
{
"name": "myclabs/deep-copy",
"version": "1.13.4",
"version": "1.14.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
"php": "^8.0"
},
"conflict": {
"doctrine/collections": "<1.6.8",
@@ -3607,15 +3607,15 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
"source": "https://github.com/myclabs/DeepCopy/tree/1.14.0"
},
"funding": [
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
"type": "tidelift"
"url": "https://github.com/mnapoli",
"type": "github"
}
],
"time": "2025-08-01T08:46:24+00:00"
"time": "2026-08-11T10:17:44+00:00"
},
{
"name": "nikic/php-parser",
@@ -4252,23 +4252,23 @@
},
{
"name": "phpunit/php-file-iterator",
"version": "7.0.0",
"version": "7.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "6e5aa1fb0a95b1703d83e721299ee18bb4e2de50"
"reference": "3ccaa29123548190af12fee7af078dcd7f3ddfab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6e5aa1fb0a95b1703d83e721299ee18bb4e2de50",
"reference": "6e5aa1fb0a95b1703d83e721299ee18bb4e2de50",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3ccaa29123548190af12fee7af078dcd7f3ddfab",
"reference": "3ccaa29123548190af12fee7af078dcd7f3ddfab",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.0"
"phpunit/phpunit": "^13.3.0"
},
"type": "library",
"extra": {
@@ -4301,7 +4301,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
"security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy",
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/7.0.0"
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/7.0.1"
},
"funding": [
{
@@ -4321,7 +4321,7 @@
"type": "tidelift"
}
],
"time": "2026-02-06T04:33:26+00:00"
"time": "2026-08-10T06:43:12+00:00"
},
{
"name": "phpunit/php-invoker",
@@ -4609,16 +4609,16 @@
},
{
"name": "phpunit/phpunit",
"version": "13.3.0",
"version": "13.3.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "346fcba6ce7ab89bb1b0675feac6bc29c0f7711b"
"reference": "fc024931d6ad047404e9d86536735923fe63a06b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/346fcba6ce7ab89bb1b0675feac6bc29c0f7711b",
"reference": "346fcba6ce7ab89bb1b0675feac6bc29c0f7711b",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc024931d6ad047404e9d86536735923fe63a06b",
"reference": "fc024931d6ad047404e9d86536735923fe63a06b",
"shasum": ""
},
"require": {
@@ -4628,12 +4628,12 @@
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.13.4",
"myclabs/deep-copy": "^1.14.0",
"phar-io/manifest": "^2.0.4",
"phar-io/version": "^3.2.1",
"php": ">=8.4.1",
"phpunit/php-code-coverage": "^14.3",
"phpunit/php-file-iterator": "^7.0.0",
"phpunit/php-file-iterator": "^7.0.1",
"phpunit/php-invoker": "^7.0.0",
"phpunit/php-text-template": "^6.0.0",
"phpunit/php-timer": "^9.0.0",
@@ -4645,9 +4645,9 @@
"sebastian/file-filter": "^1.0",
"sebastian/git-state": "^1.0",
"sebastian/global-state": "^9.0.1",
"sebastian/object-enumerator": "^8.0.0",
"sebastian/object-enumerator": "^8.1.0",
"sebastian/recursion-context": "^8.0.1",
"sebastian/type": "^7.0.1",
"sebastian/type": "^7.0.2",
"sebastian/version": "^7.0.0",
"staabm/side-effects-detector": "^1.0.5"
},
@@ -4689,7 +4689,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/13.3.0"
"source": "https://github.com/sebastianbergmann/phpunit/tree/13.3.1"
},
"funding": [
{
@@ -4697,20 +4697,20 @@
"type": "other"
}
],
"time": "2026-08-07T07:37:01+00:00"
"time": "2026-08-13T13:14:23+00:00"
},
{
"name": "rector/rector",
"version": "2.6.1",
"version": "2.6.2",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
"reference": "b8e68f058bca43e01a2e1caa51ef022d6551ed95"
"reference": "03cd615cdd5648abb5f10ff3a684fdb976687190"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/b8e68f058bca43e01a2e1caa51ef022d6551ed95",
"reference": "b8e68f058bca43e01a2e1caa51ef022d6551ed95",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/03cd615cdd5648abb5f10ff3a684fdb976687190",
"reference": "03cd615cdd5648abb5f10ff3a684fdb976687190",
"shasum": ""
},
"require": {
@@ -4749,7 +4749,7 @@
],
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/2.6.1"
"source": "https://github.com/rectorphp/rector/tree/2.6.2"
},
"funding": [
{
@@ -4757,7 +4757,7 @@
"type": "github"
}
],
"time": "2026-08-03T17:30:34+00:00"
"time": "2026-08-12T06:23:05+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -5519,30 +5519,29 @@
},
{
"name": "sebastian/object-enumerator",
"version": "8.0.0",
"version": "8.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "b39ab125fd9a7434b0ecbc4202eebce11a98cfc5"
"reference": "511064ecde82bd747e2ba2fab3dda8d977b59576"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/b39ab125fd9a7434b0ecbc4202eebce11a98cfc5",
"reference": "b39ab125fd9a7434b0ecbc4202eebce11a98cfc5",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/511064ecde82bd747e2ba2fab3dda8d977b59576",
"reference": "511064ecde82bd747e2ba2fab3dda8d977b59576",
"shasum": ""
},
"require": {
"php": ">=8.4",
"sebastian/object-reflector": "^6.0",
"sebastian/recursion-context": "^8.0"
"sebastian/recursion-context": "^8.0.1"
},
"require-dev": {
"phpunit/phpunit": "^13.0"
"phpunit/phpunit": "^13.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "8.0-dev"
"dev-main": "8.1-dev"
}
},
"autoload": {
@@ -5565,7 +5564,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
"security": "https://github.com/sebastianbergmann/object-enumerator/security/policy",
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/8.0.0"
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/8.1.0"
},
"funding": [
{
@@ -5585,27 +5584,27 @@
"type": "tidelift"
}
],
"time": "2026-02-06T04:46:36+00:00"
"time": "2026-08-13T07:05:05+00:00"
},
{
"name": "sebastian/object-reflector",
"version": "6.0.0",
"version": "6.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-reflector.git",
"reference": "3ca042c2c60b0eab094f8a1b6a7093f4d4c72200"
"reference": "f71bbcdc4f95456b4622810bec64eb06372e25b2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/3ca042c2c60b0eab094f8a1b6a7093f4d4c72200",
"reference": "3ca042c2c60b0eab094f8a1b6a7093f4d4c72200",
"url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/f71bbcdc4f95456b4622810bec64eb06372e25b2",
"reference": "f71bbcdc4f95456b4622810bec64eb06372e25b2",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.0"
"phpunit/phpunit": "^13.3.0"
},
"type": "library",
"extra": {
@@ -5633,7 +5632,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/object-reflector/issues",
"security": "https://github.com/sebastianbergmann/object-reflector/security/policy",
"source": "https://github.com/sebastianbergmann/object-reflector/tree/6.0.0"
"source": "https://github.com/sebastianbergmann/object-reflector/tree/6.1.0"
},
"funding": [
{
@@ -5653,7 +5652,7 @@
"type": "tidelift"
}
],
"time": "2026-02-06T04:47:13+00:00"
"time": "2026-08-13T06:34:36+00:00"
},
{
"name": "sebastian/recursion-context",
@@ -5733,23 +5732,23 @@
},
{
"name": "sebastian/type",
"version": "7.0.1",
"version": "7.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
"reference": "fee0309275847fefd7636167085e379c1dbf6990"
"reference": "bd1df467864cb95140414059a535b2d906173fcf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fee0309275847fefd7636167085e379c1dbf6990",
"reference": "fee0309275847fefd7636167085e379c1dbf6990",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/bd1df467864cb95140414059a535b2d906173fcf",
"reference": "bd1df467864cb95140414059a535b2d906173fcf",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.1.10"
"phpunit/phpunit": "^13.3.0"
},
"type": "library",
"extra": {
@@ -5778,7 +5777,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/type/issues",
"security": "https://github.com/sebastianbergmann/type/security/policy",
"source": "https://github.com/sebastianbergmann/type/tree/7.0.1"
"source": "https://github.com/sebastianbergmann/type/tree/7.0.2"
},
"funding": [
{
@@ -5798,7 +5797,7 @@
"type": "tidelift"
}
],
"time": "2026-05-20T06:49:11+00:00"
"time": "2026-08-10T08:00:57+00:00"
},
{
"name": "sebastian/version",
+2 -2
View File
@@ -2,9 +2,9 @@
/* require this file to have a fully-initialized Gazelle runtime */
if (PHP_VERSION_ID < 80406) {
if (PHP_VERSION_ID < 80509) {
$version = phpversion();
die("Gazelle (Orpheus fork) requires at least PHP version 8.4.6, you have $version\n");
die("Gazelle (Orpheus fork) requires at least PHP version 8.5.9, you have $version\n");
}
foreach (['memcached', 'mysqli'] as $e) {
if (!extension_loaded($e)) {
+1
View File
@@ -37,6 +37,7 @@ RUN apt-get update \
php${PHP_VER}-fpm \
php${PHP_VER}-gd \
php${PHP_VER}-iconv \
php${PHP_VER}-intl \
php${PHP_VER}-mbstring \
php${PHP_VER}-memcached \
php${PHP_VER}-mysql \
+1 -1
View File
@@ -16,7 +16,7 @@ authorize();
$redirectId = (int)$_POST['redirect'];
$newName = Artist::sanitize($_POST['name']);
if (empty($newName)) {
if (!$newName) {
Error400::error('The specified name is empty.');
}
+1 -1
View File
@@ -22,7 +22,7 @@ if (is_null($artist) || empty($_POST['aliasid'])) {
$aliasId = (int)$_POST['aliasid'];
$newName = Artist::sanitize($_POST['name']);
if (empty($newName)) {
if (!$newName) {
Error400::error('No new name given.');
} elseif (!isset($artist->aliasList()[$aliasId])) {
Error400::error('Could not find existing alias ID');
+1 -1
View File
@@ -212,7 +212,7 @@ if ($isMusicUpload && !$Properties['GroupID']) {
];
for ($i = 0, $end = count($Artists); $i < $end; $i++) {
$name = Artist::sanitize($Artists[$i]);
if ($name === '') {
if (!$name) {
continue;
}
$roleId = $artistRole[$i];