You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
getAttributeValue() emits null-array-offset deprecation on PHP 8.4+ #19
InputDataContainer::getAttributeValue() emits a PHP deprecation on every call made without an explicit $key.
Where
src/InputDataContainer.php (line 37 in the released 1.2.3):
publicfunctiongetAttributeValue($key = null)
{
...
} elseif (isset($data[$key])) { // $key is null on the default call
Why it fires
As of PHP 8.4/8.5, isset() is no longer exempt from the null-array-offset deprecation:
$ php -r '$d = ["a" => 1]; $k = null; var_dump(isset($d[$k]));'
PHP Deprecated: Using null as an array offset is deprecated, use an empty string instead
bool(false)
Verified on PHP 8.5.9. Both isset($data[$key]) and the later $data[$this->attributeKey] read are affected when the value is null.
Impact
Every validated request in a consuming plugin logs the notice. In Bit CRM it also leaks into the HTTP response body — the REST envelope's additional field carries the raw deprecation text, e.g.:
{"status":"success","code":"SUCCESS","data":"Note created successfully!",
"additional":"\nDeprecated: Using null as an array offset is deprecated, use an empty string instead in .../wp-validator/src/InputDataContainer.php on line 37"}
Suggested fix
Normalize the offset before use, e.g. $key ?? '', or guard with $key !== null && isset($data[$key]). The attributeKey read on the following branch needs the same treatment (it is already null-coalesced at line 31 for trim(), but not where it is used as an offset).
Reproduce
Call any validator rule path that reaches getAttributeValue() with no argument under PHP 8.4+.
Fixed by #20, released in 1.2.4. Updating to 1.2.4 or later removes this deprecation from normal Validator runs, including the notice leaking into REST responses. Checked on PHP 8.5.12.
The deprecation comes from PHP 8.5, not 8.4: PHP 8.4.24 does not emit it.
Two minor leftovers remain, neither part of the reported problem:
same:0 passes on a mismatch, because $key && treats 0 and '0' as no key. This only affects a same rule pointing at a field named 0.
InputDataContainer still emits the deprecation when it is used directly with no attribute key set. Validator always sets a key, so it does not hit this.
Activity
csemazharul commentedon Nov 2, 2026
Fixed by #20, released in 1.2.4. Updating to 1.2.4 or later removes this deprecation from normal
Validatorruns, including the notice leaking into REST responses. Checked on PHP 8.5.12.The deprecation comes from PHP 8.5, not 8.4: PHP 8.4.24 does not emit it.
Two minor leftovers remain, neither part of the reported problem:
same:0passes on a mismatch, because$key &&treats0and'0'as no key. This only affects asamerule pointing at a field named0.InputDataContainerstill emits the deprecation when it is used directly with no attribute key set.Validatoralways sets a key, so it does not hit this.