Skip to content

Commit

Permalink
Merge tag v2.1.46 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Sep 28, 2023
1 parent 7036335 commit 673e944
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ private function checkIfBundleRelativePath(string $path, ContainerBuilder $conta
{
if (isset($path[0]) && $path[0] === '@') {
$pathParts = explode('/', $path);
$bundleName = substr($pathParts[0], 1);
$bundleName = \mb_substr($pathParts[0], 1);

$bundlePath = $this->getBundlePath($bundleName, $container);

return $bundlePath . substr($path, strlen('@' . $bundleName));
return $bundlePath . \mb_substr($path, \mb_strlen('@' . $bundleName));
}

return $path;
Expand Down
8 changes: 4 additions & 4 deletions src/Doctrine/EventSubscriber/FontLifeCycleSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public function preRemove(LifecycleEventArgs $args): void
try {
// factorize previous code with loop
foreach (self::$formats as $format) {
$getter = 'get' . mb_strtoupper($format) . 'Filename';
$relativeUrlGetter = 'get' . mb_strtoupper($format) . 'RelativeUrl';
$getter = 'get' . \mb_strtoupper($format) . 'Filename';
$relativeUrlGetter = 'get' . \mb_strtoupper($format) . 'RelativeUrl';
if (null !== $entity->$getter() && $this->fontStorage->fileExists($entity->$relativeUrlGetter())) {
$this->fontStorage->delete($entity->$relativeUrlGetter());
$this->logger->info('Font file deleted', ['file' => $entity->$relativeUrlGetter()]);
Expand Down Expand Up @@ -136,7 +136,7 @@ public function setFontFilesNames(Font $font): void
/** @var UploadedFile|null $file */
$file = $font->{'get' . ucfirst($format) . 'File'}();
if (null !== $file) {
$font->{'set' . mb_strtoupper($format) . 'Filename'}($file->getClientOriginalName());
$font->{'set' . \mb_strtoupper($format) . 'Filename'}($file->getClientOriginalName());
}
}
}
Expand All @@ -152,7 +152,7 @@ public function upload(Font $font): void
/** @var UploadedFile|null $file */
$file = $font->{'get' . ucfirst($format) . 'File'}();
/** @var string|null $relativeUrl */
$relativeUrl = $font->{'get' . mb_strtoupper($format) . 'RelativeUrl'}();
$relativeUrl = $font->{'get' . \mb_strtoupper($format) . 'RelativeUrl'}();
if (null !== $file && null !== $relativeUrl) {
$filename = $file->getPathname();
$fontResource = fopen($file->getPathname(), 'r');
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Font extends AbstractDateTimed
*/
public function __construct()
{
$this->folder = substr(hash("crc32b", date('YmdHi')), 0, 12);
$this->folder = \mb_substr(hash("crc32b", date('YmdHi')), 0, 12);
$this->initAbstractDateTimed();
}

Expand Down Expand Up @@ -331,7 +331,7 @@ public function setHash(string $hash): Font
*/
public function generateHashWithSecret(string $secret): Font
{
$this->hash = substr(hash("crc32b", $this->name . $secret), 0, 12);
$this->hash = \mb_substr(hash("crc32b", $this->name . $secret), 0, 12);

return $this;
}
Expand Down

0 comments on commit 673e944

Please sign in to comment.