Skip to content

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Sep 30, 2024

Commits should be reviewed in order.

I am planning on tackling the usage of convert_to_string() too, but this was getting long enough.

@nielsdos
Copy link
Member

nielsdos commented Oct 1, 2024

CI failures seem legit

@Girgias Girgias force-pushed the ldap-do-modify-refacto branch from 0d4ea3e to 89b8149 Compare October 1, 2024 12:51
@Girgias Girgias force-pushed the ldap-do-modify-refacto branch from 89b8149 to 0ef85bb Compare October 1, 2024 15:28
ext/ldap/ldap.c Outdated
} else {
SEPARATE_ARRAY(value);
num_values = zend_hash_num_elements(Z_ARRVAL_P(value));
int num_values = zend_hash_num_elements(Z_ARRVAL_P(value));
Copy link
Member

Choose a reason for hiding this comment

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

zend_hash_num_elements returns a uint32_t.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in a follow-up commit

ext/ldap/ldap.c Outdated
convert_to_string(attribute_value);
if (EG(exception)) {
num_berval[i] = j;
num_berval[i] = (int)attribute_value_index;
Copy link
Member

Choose a reason for hiding this comment

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

int may cause problems, uint32_t certainly won't.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in a follow-up commit.

ext/ldap/ldap.c Outdated
efree(ldap_mods[i]->mod_bvalues[j]);
for (LDAPMod **ptr = ldap_mods; *ptr != NULL; ptr++) {
LDAPMod *mod = *ptr;
if (mod->mod_type) {
Copy link
Member

Choose a reason for hiding this comment

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

efree doesn't need null checks.

ZEND_HASH_FOREACH_STR_KEY_VAL(attributes_ht, attribute, attribute_values) {
if (attribute == NULL) {
php_error_docref(NULL, E_WARNING, "Unknown attribute in the data");
zend_argument_value_error(3, "must be an associative array of attribute => values");
Copy link
Member

Choose a reason for hiding this comment

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

The plural use is a bit strange here. I would write attribute => value or attributes => values but not mix them. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

The thing is for a single attribute there might be multiple values attached to it

@nielsdos
Copy link
Member

nielsdos commented Oct 1, 2024

I am planning on tackling the usage of convert_to_string() too, but this was getting long enough.

Agreed.

@Girgias Girgias merged commit e8e4d36 into php:master Oct 1, 2024
10 checks passed
@Girgias Girgias deleted the ldap-do-modify-refacto branch October 1, 2024 18:57
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