fix: various small notice fixes (#3474)

* fix(patreon): php notice

* fix(pepperbridge): php notice

* fix(ebay): php notice

* fix(tiktok): php notice

* fix(yandex): fix notice

* fix(justwatch): notice

* lint
This commit is contained in:
Dag 2023-07-02 06:40:25 +02:00 committed by GitHub
parent 372880b5ef
commit 748fc9fd65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 25 deletions

View file

@ -316,7 +316,9 @@ abstract class BridgeAbstract implements BridgeInterface
}
$needle = $this->inputs[$this->queriedContext][$input]['value'];
foreach (static::PARAMETERS[$context][$input]['values'] as $first_level_key => $first_level_value) {
if ($needle === (string)$first_level_value) {
// todo: this cast emits error if it's an array
$valueString = (string) $first_level_value;
if ($needle === $valueString) {
return $first_level_key;
} elseif (is_array($first_level_value)) {
foreach ($first_level_value as $second_level_key => $second_level_value) {

View file

@ -43,6 +43,7 @@ final class Logger
$context['url'] = get_current_url();
$context['trace'] = trace_to_call_points(trace_from_exception($e));
// Don't log these exceptions
// todo: this logic belongs in log handler
$ignoredExceptions = [
'You must specify a format',
'Format name invalid',

View file

@ -420,14 +420,11 @@ function getSimpleHTMLDOMCached(
$defaultBRText = DEFAULT_BR_TEXT,
$defaultSpanText = DEFAULT_SPAN_TEXT
) {
Logger::debug(sprintf('Caching url %s, duration %d', $url, $duration));
// Initialize cache
$cacheFactory = new CacheFactory();
$cache = $cacheFactory->create();
$cache->setScope('pages');
$cache->purgeCache(86400); // 24 hours (forced)
$cache->purgeCache(86400);
$params = [$url];
$cache->setKey($params);