Skip to content

Instantly share code, notes, and snippets.

@jbrada
Created July 21, 2022 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbrada/de20589e06ebca9f7591b89eca2ad200 to your computer and use it in GitHub Desktop.
Save jbrada/de20589e06ebca9f7591b89eca2ad200 to your computer and use it in GitHub Desktop.
Issue in the Bss_ProductLabel module on Magento 2.4.4 (PHP 8.1)
1 exception(s):
Exception #0 (Exception): Deprecated Functionality: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/vendor/bsscommerce/product-label/Helper/Data.php on line 147
diff --git a/Helper/Data.php b/Helper/Data.php
index 28b2cc6..b840f3e 100644
--- a/Helper/Data.php
+++ b/Helper/Data.php
@@ -131,22 +131,21 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
*/
public function isNotDisplayOn()
{
- $display = $this->scopeConfig->getValue(
+ return (string) $this->scopeConfig->getValue(
'productlabel/general/not_display_label_on',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
- return $display;
}
/**
- * @param \Bss\ProductLabel\Model\Config\Source\PageDisplayLabel $page
+ * @param string $page
* @return bool
*/
- public function isSystemConfigAllow($page)
+ public function isSystemConfigAllow(string $page): bool
{
$pos = strpos($this->isNotDisplayOn(), $page);
- return ( ($this->isEnable() == true) && ($pos === false) );
+ return $this->isEnable() === true && $pos === false;
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment