aimeos / ai-client-html

Aimeos e-commerce HTML client components
https://aimeos.org
GNU Lesser General Public License v3.0
166 stars 58 forks source link

Undefined array key #219

Open nollm opened 3 hours ago

nollm commented 3 hours ago

I get the exception PHP Warning: Undefined array key "xyz" in this line https://github.com/aimeos/ai-client-html/blob/2024.10.1/templates/client/html/common/partials/selection.php#L116 with PHP 8.2. For me it works to check first if the array key is set <label class="select-name"><?= $enc->html( isset($attrTypes[$code]) ? $attrTypes[$code]->getName() : $this->translate( 'client/code', $code ) ) ?></label>

aimeos commented 3 hours ago

Thanks! Can you create a PR with the necessary change? The same seems to apply here: https://github.com/aimeos/ai-client-html/blob/2024.10.1/templates/client/html/common/partials/attribute.php#L95

The reason for you warning is that you use an attribute type for which no type item has been created or which has been deleted.

nollm commented 2 hours ago

Of course. I created a pull request for the master branch. Is this the right branch?