Skip to content

Fix null array offset deprecation on PHP 8.5 in Select::getRawValue()#14

Open
thedotedge wants to merge 1 commit into
pear:trunkfrom
thedotedge:fix/php85-select-null-offset
Open

Fix null array offset deprecation on PHP 8.5 in Select::getRawValue()#14
thedotedge wants to merge 1 commit into
pear:trunkfrom
thedotedge:fix/php85-select-null-offset

Conversation

@thedotedge

@thedotedge thedotedge commented Jul 24, 2026

Copy link
Copy Markdown

On PHP 8.5, Select::getRawValue() triggers:

Using null as an array offset is deprecated, use an empty string instead

at HTML/QuickForm2/Element/Select.php:183. When a select's value is null (e.g. an empty/unselected option, or a datasource returning null), the loop does $this->possibleValues[$value] with $value === null, using null as an array offset.

This casts $value to string in the offset lookup. null becomes '' — which PHP already coerced it to implicitly when used as an array key — so behavior is unchanged on all supported PHP versions, and the 8.5 deprecation no longer fires. (Numeric option values are unaffected: (string) 5 and 5 resolve to the same array key.)

This deprecation is fatal under strict mode, so any form containing a <select> fails to render on PHP 8.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant