Skip to content

Commit

Permalink
Merge branch 'bugfix'
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
#	redaxo/src/core/composer.json
#	redaxo/src/core/composer.lock
#	redaxo/src/core/vendor/composer/installed.json
#	redaxo/src/core/vendor/composer/installed.php
  • Loading branch information
gharlan committed Feb 15, 2023
2 parents 0d3cb8f + 6dd21c8 commit 752c300
Show file tree
Hide file tree
Showing 14 changed files with 399 additions and 105 deletions.
8 changes: 4 additions & 4 deletions composer.json
Expand Up @@ -23,15 +23,15 @@
"phpunit/phpunit": "^10.0.7",
"psalm/plugin-phpunit": "0.18.4",
"psalm/plugin-symfony": "v5.0.1",
"rector/rector": "0.15.13",
"rector/rector": "0.15.16",
"redaxo/php-cs-fixer-config": "2.0.0",
"redaxo/psalm-plugin": "2.0.0",
"vimeo/psalm": "5.6.0"
},
"replace": {
"erusev/parsedown": "1.7.4",
"erusev/parsedown-extra": "0.8.1",
"filp/whoops": "2.14.6",
"filp/whoops": "2.14.5",
"itsgoingd/clockwork": "v5.1.12",
"phpmailer/phpmailer": "v6.7.1",
"psr/container": "2.0.2",
Expand All @@ -43,15 +43,15 @@
"splitbrain/php-archive": "1.3.1",
"symfony/console": "v6.2.5",
"symfony/deprecation-contracts": "v3.2.0",
"symfony/http-foundation": "v6.2.5",
"symfony/http-foundation": "v6.2.6",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/service-contracts": "v3.2.0",
"symfony/string": "v6.2.5",
"symfony/var-dumper": "v6.2.5",
"symfony/yaml": "v6.2.5",
"voku/anti-xss": "4.1.39",
"voku/anti-xss": "4.1.41",
"voku/portable-ascii": "2.0.1",
"voku/portable-utf8": "6.0.12"
},
Expand Down
6 changes: 3 additions & 3 deletions redaxo/src/core/composer.json
Expand Up @@ -2,14 +2,14 @@
"require": {
"erusev/parsedown": "^1.7.4",
"erusev/parsedown-extra": "^0.8.1",
"filp/whoops": "^2.14.6",
"filp/whoops": "2.14.5",
"psr/log": "^1.1.4",
"ramsey/http-range": "^1.1",
"symfony/console": "^6.2.5",
"symfony/http-foundation": "^6.2.5",
"symfony/http-foundation": "^6.2.6",
"symfony/var-dumper": "^6.2.5",
"symfony/yaml": "^6.2.5",
"voku/anti-xss": "^4.1.39"
"voku/anti-xss": "^4.1.41"
},

"replace": {
Expand Down
38 changes: 19 additions & 19 deletions redaxo/src/core/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions redaxo/src/core/functions/function_rex_escape.php
Expand Up @@ -39,11 +39,12 @@ function rex_escape($value, $strategy = 'html')
}

if ($value instanceof stdClass) {
$clone = clone $value;
foreach (get_object_vars($value) as $k => $v) {
$value->$k = rex_escape($v, $strategy);
$clone->$k = rex_escape($v, $strategy);
}

return $value;
return $clone;
}

if (is_object($value) && method_exists($value, '__toString')) {
Expand Down
2 changes: 1 addition & 1 deletion redaxo/src/core/pages/system.log.redaxo.php
Expand Up @@ -57,7 +57,7 @@
$data = $entry->getData();

$class = strtolower($data[0]);
$class = ('notice' == $class || 'warning' == $class || 'success' == $class || 'info' == $class) ? $class : 'error';
$class = in_array($class, ['notice', 'warning', 'success', 'info', 'debug'], true) ? $class : 'error';

$path = '';
if (isset($data[2])) {
Expand Down
26 changes: 26 additions & 0 deletions redaxo/src/core/tests/functions_test.php
@@ -0,0 +1,26 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* @internal
*/
class rex_functions_test extends TestCase
{
public function testEscapeObject(): void
{
$obj = new stdClass();
$obj->num = 1;
$str = '<b>foo</b>';
$obj->str = $str;

$escapped = rex_escape($obj);

/** @psalm-suppress RedundantCondition */
static::assertSame($str, $obj->str);

static::assertInstanceOf(stdClass::class, $escapped);
static::assertSame(1, $escapped->num);
static::assertSame('&lt;b&gt;foo&lt;/b&gt;', $escapped->str);
}
}
12 changes: 8 additions & 4 deletions redaxo/src/core/vendor/composer/ClassLoader.php
Expand Up @@ -429,7 +429,8 @@ public function unregister()
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
(self::$includeFile)($file);
$includeFile = self::$includeFile;
$includeFile($file);

return true;
}
Expand Down Expand Up @@ -560,7 +561,10 @@ private function findFileWithExtension($class, $ext)
return false;
}

private static function initializeIncludeClosure(): void
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
Expand All @@ -574,8 +578,8 @@ private static function initializeIncludeClosure(): void
* @param string $file
* @return void
*/
self::$includeFile = static function($file) {
self::$includeFile = \Closure::bind(static function($file) {
include $file;
};
}, null, null);
}
}
6 changes: 3 additions & 3 deletions redaxo/src/core/vendor/composer/autoload_real.php
Expand Up @@ -33,15 +33,15 @@ public static function getLoader()
$loader->register(false);

$filesToLoad = \Composer\Autoload\ComposerStaticInitRedaxoCore::$files;
$requireFile = static function ($fileIdentifier, $file) {
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

require $file;
}
};
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
($requireFile)($fileIdentifier, $file);
$requireFile($fileIdentifier, $file);
}

return $loader;
Expand Down

0 comments on commit 752c300

Please sign in to comment.