[Scummvm-git-logs] scummvm-web master -> 285c75971790f1ad3316eeb0c69bf77d73a9ce6d
Thunderforge
noreply at scummvm.org
Thu Feb 24 02:27:48 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .
Summary:
285c759717 WEB: Adding null check before string replacement (#209)
Commit: 285c75971790f1ad3316eeb0c69bf77d73a9ce6d
https://github.com/scummvm/scummvm-web/commit/285c75971790f1ad3316eeb0c69bf77d73a9ce6d
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-02-23T20:27:44-06:00
Commit Message:
WEB: Adding null check before string replacement (#209)
Fixes errors such as
```
PHP Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /Users/Will/OpenSource/scummvm-web/include/Objects/File.php on line 26
```
Changed paths:
include/Objects/File.php
include/OrmObjects/Download.php
diff --git a/include/Objects/File.php b/include/Objects/File.php
index 2adc5b3e..b6acb5b7 100644
--- a/include/Objects/File.php
+++ b/include/Objects/File.php
@@ -23,7 +23,7 @@ class File extends BasicObject
$this->notes = isset($data['notes']) ? $data['notes'] : '';
$this->subcategory = $data['subcategory'] ?? null;
$this->user_agent = isset($data["user_agent"]) ? $data["user_agent"] : "";
- $this->version = strtolower($data['version'] ?? null);
+ $this->version = isset($data['version']) ? strtolower($data['version']) : null;
/* If it's not an array, we didn't get any attributes. */
if (!is_array($data['url'])) {
diff --git a/include/OrmObjects/Download.php b/include/OrmObjects/Download.php
index 45c6d624..a72421d8 100644
--- a/include/OrmObjects/Download.php
+++ b/include/OrmObjects/Download.php
@@ -20,7 +20,7 @@ class Download extends BaseDownload
$name = parent::getName();
$version = $this->getVersion();
// If it's not the latest version and not daily, prefix with the version number
- if ($version != RELEASE && $version != 'Daily') {
+ if ($version != null && $version != RELEASE && $version != 'Daily') {
return str_replace('{$version}', $version, "$version $name");
}
return $name;
More information about the Scummvm-git-logs
mailing list