|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71249 ldap_mod_replace/ldap_mod_add store value as string "Array"
Submitted: 2015-12-30 20:11 UTC Modified: 2015-12-31 13:56 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: post at rolandgruber dot de Assigned: laruence (profile)
Status: Closed Package: LDAP related
PHP Version: 7.0.1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
25 - 8 = ?
Subscribe to this entry?

 [2015-12-30 20:11 UTC] post at rolandgruber dot de
The following parameter $entry results in storing the plain string "Array" in LDAP:

            [initials] => Array
                    [0] => 11


Looks like the functions no longer check the type of the array values. The same call in PHP 5.6 stores the correct value "11".

Expected result:
Instead of setting LDAP attribute to "Array" the value should be "11".

Actual result:
LDAP attribute gets value "Array"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-31 02:26 UTC]
-Status: Open +Status: Feedback
 [2015-12-31 02:26 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2015-12-31 02:27 UTC]
-Status: Feedback +Status: Open
 [2015-12-31 02:27 UTC]
mistake set... restore.
 [2015-12-31 02:28 UTC]
could you please try with the following quick fix?

diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index e0faf24..b1cb6bf 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1460,6 +1460,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)

                value = zend_hash_get_current_data(Z_ARRVAL_P(entry));

+         ZVAL_DEREF(value);
                if (Z_TYPE_P(value) != IS_ARRAY) {
                        num_values = 1;
                } else {

 [2015-12-31 02:28 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: laruence
 [2015-12-31 13:56 UTC] post at rolandgruber dot de
-Status: Feedback +Status: Assigned
 [2015-12-31 13:56 UTC] post at rolandgruber dot de
I added the line and now it works. :) The attribute gets the correct value.
Please add this to the next release.

Thanks a lot for your fast help and have a great start into 2016!
 [2016-01-01 15:07 UTC]
Automatic comment on behalf of
Log: Fixed bug #71249 (ldap_mod_replace/ldap_mod_add store value as string &quot;Array&quot;)
 [2016-01-01 15:07 UTC]
-Status: Assigned +Status: Closed
 [2016-07-20 11:34 UTC]
Automatic comment on behalf of
Log: Fixed bug #71249 (ldap_mod_replace/ldap_mod_add store value as string &quot;Array&quot;)
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Aug 07 19:03:40 2022 UTC