]> granicus.if.org Git - php/commitdiff
Added destruction of return value parameter, and using ZVAL_LONG and
authorStig Venaas <venaas@php.net>
Wed, 18 Oct 2000 07:47:51 +0000 (07:47 +0000)
committerStig Venaas <venaas@php.net>
Wed, 18 Oct 2000 07:47:51 +0000 (07:47 +0000)
ZVAL_STRING to set return value in ldap_get_option.

ext/ldap/ldap.c

index b07525d3218a6b0a9e0723203047c23e0b5481cb..6bf16de8caeb1a6c1a9f5e28122923ce26e21691 100644 (file)
@@ -1525,8 +1525,8 @@ PHP_FUNCTION(ldap_get_option) {
                        if (ldap_get_option(ldap, opt, &val)) {
                                RETURN_FALSE;
                        }
-                       (*retval)->type = IS_LONG;
-                       (*retval)->value.lval = val;  
+                       zval_dtor(*retval);
+                        ZVAL_LONG(*retval, val);
                } break;
                /* options with string value */
        case LDAP_OPT_HOST_NAME:
@@ -1538,10 +1538,8 @@ PHP_FUNCTION(ldap_get_option) {
                        if (ldap_get_option(ldap, opt, &val)) {
                                RETURN_FALSE;
                        }
-                       (*retval)->type = IS_STRING;
-                       len = strlen(val);
-                       (*retval)->value.str.len = len;
-                       (*retval)->value.str.val = estrndup(val, len);
+                       zval_dtor(*retval);
+                        ZVAL_STRING(*retval, val, 1);
                        ldap_memfree(val);
                } break;
                /* options not implemented