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

From: Date: Wed, 01 May 2019 18:57:53 +0000
Subject: Bug #77958 [NEW]: values in ldap_modify_batch must be "string"
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220671@lists.php.net to get a copy of this message
From: uther240 at gmail dot com Operating system: Debian PHP version: 7.1.28 Package: LDAP related Bug Type: Bug Bug description:values in ldap_modify_batch must be "string" 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 bug report at https://bugs.php.net/bug.php?id=77958&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77958&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77958&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77958&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77958&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77958&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77958&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77958&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77958&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77958&r=support Expected behavior: https://bugs.php.net/fix.php?id=77958&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77958&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77958&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77958&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77958&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77958&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77958&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77958&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77958&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77958&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77958&r=mysqlcfg

« previous php.bugs (#220671) next »