Bug #71249 [Asn->Csd]: ldap_mod_replace/ldap_mod_add store value as string "Array"

From: Date: Fri, 01 Jan 2016 15:07:45 +0000
Subject: Bug #71249 [Asn->Csd]: ldap_mod_replace/ldap_mod_add store value as string "Array"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198344@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71249&edit=1

 ID:                 71249
 Updated by:         laruence@php.net
 Reported by:        post at rolandgruber dot de
 Summary:            ldap_mod_replace/ldap_mod_add store value as string
                     "Array"
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            LDAP related
 Operating System:   Linux
 PHP Version:        7.0.1
 Assigned To:        laruence
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=87958927b0cef17ba06a8739c7febca8e920c6de
Log: Fixed bug #71249 (ldap_mod_replace/ldap_mod_add store value as string
"Array")


Previous Comments:
------------------------------------------------------------------------
[2015-12-31 13:56:36] 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!

------------------------------------------------------------------------
[2015-12-31 02:28:36] laruence@php.net

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 {

thanks

------------------------------------------------------------------------
[2015-12-31 02:27:08] laruence@php.net

mistake set... restore.

------------------------------------------------------------------------
[2015-12-31 02:26:52] laruence@php.net

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-30 20:11:28] post at rolandgruber dot de

Description:
------------
The following parameter $entry results in storing the plain string "Array" in LDAP:

Array
        (
            [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"


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71249&edit=1


Thread (7 messages)

« previous php.bugs (#198344) next »