- Issue created by @b.khouy
- Merge request !191Issue #3438998: Fix undefined array key "bundle" on ComponentBlock plugin class → (Open) created by b.khouy
- Status changed to Needs review
5 months ago 12:39pm 2 September 2024 - Issue was unassigned.
- Status changed to Needs work
5 months ago 9:16am 3 September 2024 - 🇫🇷France pdureau Paris
Hi Brahim,
- if (!$this->context["bundle"] && isset($this->context["entity"])) { + if (!isset($this->context["bundle"]) && isset($this->context["entity"])) {
Determine if a variable is considered set, this means if a variable is declared and is different than null.
Source: https://www.php.net/manual/fr/function.isset.php
Are we losing something with this change? What is happening if
$this->context["bundle"]
return a value resolving tofalse
, but not tonull
?Those are genuine questions, not rhetorical, I am not a PHP expert.
- Status changed to Closed: duplicate
5 months ago 10:11am 5 September 2024 - 🇫🇷France pdureau Paris
already done in 📌 [2.0.0-beta2] ContextHelper cleaning Fixed
But we will not forget you in the credits
- 🇲🇦Morocco b.khouy 🇲🇦 Morocco
@pdureau
If
$this->context["bundle"]
is expected to return either astring
(the bundle), aboolean
(for reasons that are unclear), ornull
, and the condition needs to be valid when the bundle is not null or when the bundle is false, the condition should be written like this:
if (!isset($this->context["bundle"]) && $this->context["bundle"] && isset($this->context["entity"])) {
Ultimately, the correct approach depends on your requirements. It looks like this issue has already been resolved in: 📌 [2.0.0-beta2] ContextHelper cleaning Fixed
:)