mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 22:18:40 +00:00
Handle wrong path
This commit is contained in:
parent
0f19264e86
commit
1553e1f28e
|
|
@ -88,8 +88,8 @@ class InfoManager
|
||||||
*/
|
*/
|
||||||
public function load() /* : void */
|
public function load() /* : void */
|
||||||
{
|
{
|
||||||
if (!file_exists($this->path)) {
|
if ($this->path === false || !file_exists($this->path)) {
|
||||||
throw new PathException($this->path);
|
throw new PathException((string) $this->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info = json_decode(file_get_contents($this->path), true);
|
$this->info = json_decode(file_get_contents($this->path), true);
|
||||||
|
|
@ -105,8 +105,8 @@ class InfoManager
|
||||||
*/
|
*/
|
||||||
public function update() /* : void */
|
public function update() /* : void */
|
||||||
{
|
{
|
||||||
if (!file_exists($this->path)) {
|
if ($this->path === false || !file_exists($this->path)) {
|
||||||
throw new PathException($this->path);
|
throw new PathException((string) $this->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($this->path, json_encode($this->info, JSON_PRETTY_PRINT));
|
file_put_contents($this->path, json_encode($this->info, JSON_PRETTY_PRINT));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user