Bug #77958 [Opn]: values in ldap_modify_batch must be "string"

From: Date: Wed, 01 May 2019 22:20:54 +0000
Subject: Bug #77958 [Opn]: values in ldap_modify_batch must be "string"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220672@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77958&edit=1 ID: 77958 Updated by: cmb@php.net Reported by: uther240 at gmail dot com Summary: values in ldap_modify_batch must be "string" Status: Open Type: Bug Package: LDAP related Operating System: Debian PHP Version: 7.1.28 -Assigned To: +Assigned To: mcmic Block user comment: N Private report: N New Comment: Besides that I don't agree that a phone number is inherently a number, internally calling convert_to_string() might be an option. Anyhow, could you have a look at this, Côme? Previous Comments: ------------------------------------------------------------------------ [2019-05-01 18:57:53] uther240 at gmail dot com Description: ------------ I am not entirely certain this is a "bug" per se, but think it is at least not functioning the way it should... when modifying a value in ldap that is inherently a number (like a phone number), it throws the error: ldap_modify_batch(): Each element of a 'values' array must be a string. Though I understand that this is by-design... I feel that the 'value' passed should be a 'scalar', not explicitly a string... i.e. it did not seem intuitive that I should have to cast the number to string first: (e.g. $value . ''). There may not be a reasonable way to fix this however, as there is no IS_SCALAR in zend_types (rightly so... as we are talking about C data types, not php data types in this context). Given the nature of the issue, I think the easiest fix would be in https://github.com/php/php-src/blob/master/ext/ldap/ldap.c line 2704, by adding a check for IS_(LONG|DOUBLE) and performing an snprintf on it, and that just may not be worth it... I leave it to you. thanks Test script: --------------- ldap_modify_batch($connection, $dn, [ 'attrib' => 'mobile', 'modtype' => LDAP_MODIFY_BATCH_ADD, 'values' => [ 1234567 ] ]); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77958&edit=1

« previous php.bugs (#220672) next »