}
if (DI::args()->getArgc() > 3 && DI::args()->getArgv()[2] === 'album') {
- if (!Strings::isHex(DI::args()->getArgv()[3])) {
+ if (!Strings::isHex(DI::args()->getArgv()[3] ?? '')) {
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
}
$album = hex2bin(DI::args()->getArgv()[3]);
return;
}
- $selname = Strings::isHex($datum) ? hex2bin($datum) : '';
+ $selname = (!is_null($datum) && Strings::isHex($datum)) ? hex2bin($datum) : '';
$albumselect = '';
// Display a single photo album
if ($datatype === 'album') {
// if $datum is not a valid hex, redirect to the default page
- if (!Strings::isHex($datum)) {
+ if (is_null($datum) || !Strings::isHex($datum)) {
DI::baseUrl()->redirect('photos/' . $user['nickname']. '/album');
}
$album = hex2bin($datum);
'input' => '',
'valid' => false,
],
- 'nullHex' => [
- 'input' => null,
- 'valid' => false,
- ],
];
}
/**
* Tests if the string is a valid hexadecimal value
*
- * @param string|null $input
- * @param bool $valid
+ * @param string $input
+ * @param bool $valid
*
* @dataProvider dataIsHex
*/
- public function testIsHex(string $input = null, bool $valid = false)
+ public function testIsHex(string $input = '', bool $valid = false)
{
self::assertEquals($valid, Strings::isHex($input));
}