Skip to content

Fix the type reported by the ldap_modify_batch() type errors - #25373

Open
lacatoire wants to merge 1 commit into
php:PHP-8.5from
lacatoire:fix/ldap-modify-batch-type-error-value-8.5
Open

lacatoire wants to merge 1 commit into
php:PHP-8.5from
lacatoire:fix/ldap-modify-batch-type-error-value-8.5

Conversation

@lacatoire

@lacatoire lacatoire commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Two type errors of ldap_modify_batch() (the "modtype" option must be of type int, the "values" option must be of type array) reported the type of attrib, a string already checked at that point, instead of the type of the rejected value. They now report the type of the value.

ldap_modify_batch_programming_error.phpt expected the wrong type for its stdClass modtype, so its expected output is updated.

To reproduce

ldap_modify_batch(ldap_connect('ldap://127.0.0.1:1'), "cn=x", [["attrib" => "a", "modtype" => [], "values" => ["v"]]]);

Before: ... must be of type int, string given

After: ... must be of type int, array given

Comment on lines +10 to +11
[["attrib" => "a", "modtype" => "x", "values" => ["v"]]],
[["attrib" => "a", "modtype" => LDAP_MODIFY_BATCH_ADD, "values" => "v"]],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two pass a string, and the old code also reported string given, so they pass without the fix. A non-string value such as 1.5 or null would make them catch it.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants