From 7799fb99eded6944446fcd9dac106ac04e8fdf86 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 20 Jun 2020 12:45:18 -0400 Subject: [PATCH 1/2] [Composer] Update dependency mrpetovan/Net_Ping to version 1.2 --- composer.json | 2 +- composer.lock | 113 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 103 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index b95877d..9f4de41 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "laminas/laminas-escaper": "^2.6", "masterminds/html5": "^2.3", "monolog/monolog": "^1.17", - "mrpetovan/net_ping": "^1.0", + "mrpetovan/net_ping": "^1.2", "sarahman/simple-filesystem-cache": "^1.0", "seld/cli-prompt": "^1.0", "slim/slim": "^3.1", diff --git a/composer.lock b/composer.lock index e5673fb..884f061 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "34cc94e6a8931ab71e98a20cfbcd2299", + "content-hash": "32addc73d4c20158a63877c57d3654dc", "packages": [ { "name": "asika/simple-console", @@ -173,16 +173,16 @@ }, { "name": "bower-asset/fontawesome", - "version": "5.13.0", + "version": "5.13.1", "source": { "type": "git", "url": "https://github.com/FortAwesome/Font-Awesome.git", - "reference": "4e6402443679e0a9d12c7401ac8783ef4646657f" + "reference": "1147d199a35293b391152ee85e2d30988439157f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FortAwesome/Font-Awesome/zipball/4e6402443679e0a9d12c7401ac8783ef4646657f", - "reference": "4e6402443679e0a9d12c7401ac8783ef4646657f", + "url": "https://api.github.com/repos/FortAwesome/Font-Awesome/zipball/1147d199a35293b391152ee85e2d30988439157f", + "reference": "1147d199a35293b391152ee85e2d30988439157f", "shasum": "" }, "type": "bower-asset-library" @@ -1063,20 +1063,20 @@ }, { "name": "mrpetovan/net_ping", - "version": "1.1.1", + "version": "1.2", "source": { "type": "git", "url": "https://github.com/MrPetovan/Net_Ping.git", - "reference": "cb82b6f068012cec757c7ac93f79c5af2a3f8255" + "reference": "879df5061c86772c4cf213f9ec01f6348c4d7adf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MrPetovan/Net_Ping/zipball/cb82b6f068012cec757c7ac93f79c5af2a3f8255", - "reference": "cb82b6f068012cec757c7ac93f79c5af2a3f8255", + "url": "https://api.github.com/repos/MrPetovan/Net_Ping/zipball/879df5061c86772c4cf213f9ec01f6348c4d7adf", + "reference": "879df5061c86772c4cf213f9ec01f6348c4d7adf", "shasum": "" }, "require": { - "pear/pear_exception": "*" + "pear/pear-core-minimal": "^1.10" }, "require-dev": { "phpunit/phpunit": "*" @@ -1122,7 +1122,7 @@ } ], "description": "More info available on: http://pear.php.net/package/Net_Ping", - "time": "2018-11-08T12:14:54+00:00" + "time": "2020-06-20T15:52:11+00:00" }, { "name": "nikic/fast-route", @@ -1170,6 +1170,97 @@ ], "time": "2018-02-13T20:26:39+00:00" }, + { + "name": "pear/console_getopt", + "version": "v1.4.3", + "source": { + "type": "git", + "url": "https://github.com/pear/Console_Getopt.git", + "reference": "a41f8d3e668987609178c7c4a9fe48fecac53fa0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Console_Getopt/zipball/a41f8d3e668987609178c7c4a9fe48fecac53fa0", + "reference": "a41f8d3e668987609178c7c4a9fe48fecac53fa0", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Console": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Andrei Zmievski", + "email": "andrei@php.net", + "role": "Lead" + }, + { + "name": "Stig Bakken", + "email": "stig@php.net", + "role": "Developer" + }, + { + "name": "Greg Beaver", + "email": "cellog@php.net", + "role": "Helper" + } + ], + "description": "More info available on: http://pear.php.net/package/Console_Getopt", + "time": "2019-11-20T18:27:48+00:00" + }, + { + "name": "pear/pear-core-minimal", + "version": "v1.10.10", + "source": { + "type": "git", + "url": "https://github.com/pear/pear-core-minimal.git", + "reference": "625a3c429d9b2c1546438679074cac1b089116a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/625a3c429d9b2c1546438679074cac1b089116a7", + "reference": "625a3c429d9b2c1546438679074cac1b089116a7", + "shasum": "" + }, + "require": { + "pear/console_getopt": "~1.4", + "pear/pear_exception": "~1.0" + }, + "replace": { + "rsky/pear-core-min": "self.version" + }, + "type": "library", + "autoload": { + "psr-0": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "src/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@php.net", + "role": "Lead" + } + ], + "description": "Minimal set of PEAR core files to be used as composer dependency", + "time": "2019-11-19T19:00:24+00:00" + }, { "name": "pear/pear_exception", "version": "v1.0.1", From 0c203131b99bb10fdc5d409bf408127723c28b62 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 20 Jun 2020 12:47:17 -0400 Subject: [PATCH 2/2] Increase specificity of checks of $param - Avoids warnings and notices --- src/classes/Pollers/Profile.php | 2 +- src/classes/Utils/Scrape.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/classes/Pollers/Profile.php b/src/classes/Pollers/Profile.php index 91a5169..9b12aef 100644 --- a/src/classes/Pollers/Profile.php +++ b/src/classes/Pollers/Profile.php @@ -141,7 +141,7 @@ public function __invoke(string $profile_uri) } // Empty result is due to an offline site. - if (count($params) < 2) { + if (empty($params) || count($params) < 2) { //But for sites that are already in bad status. Do a cleanup now. if ($profile_id && $server['health_score'] < $this->settings['remove_profile_health_threshold']) { $this->profileModel->deleteById($profile_id); diff --git a/src/classes/Utils/Scrape.php b/src/classes/Utils/Scrape.php index 2859a84..758147c 100644 --- a/src/classes/Utils/Scrape.php +++ b/src/classes/Utils/Scrape.php @@ -23,7 +23,7 @@ public static function retrieveNoScrapeData(string $url) } $params = json_decode($data, true); - if (!$params || !count($params)) { + if (empty($params) || !is_array($params)) { return false; }