@@ -1572,7 +1572,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
15721572 LDAPControl * * lserverctrls = NULL ;
15731573 int ldap_attrsonly = 0 , ldap_sizelimit = -1 , ldap_timelimit = -1 , ldap_deref = -1 ;
15741574 int old_ldap_sizelimit = -1 , old_ldap_timelimit = -1 , old_ldap_deref = -1 ;
1575- int num_attribs = 0 , ret = 1 , i , errno , argcount = ZEND_NUM_ARGS ();
1575+ int num_attribs = 0 , ret = 1 , i , ldap_errno , argcount = ZEND_NUM_ARGS ();
15761576
15771577 ZEND_PARSE_PARAMETERS_START (3 , 9 )
15781578 Z_PARAM_ZVAL (link )
@@ -1779,30 +1779,30 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
17791779 php_set_opts (ld -> link , ldap_sizelimit , ldap_timelimit , ldap_deref , & old_ldap_sizelimit , & old_ldap_timelimit , & old_ldap_deref );
17801780
17811781 /* Run the actual search */
1782- errno = ldap_search_ext_s (ld -> link , ZSTR_VAL (ldap_base_dn ), scope , ZSTR_VAL (ldap_filter ), ldap_attrs , ldap_attrsonly , lserverctrls , NULL , NULL , ldap_sizelimit , & ldap_res );
1782+ ldap_errno = ldap_search_ext_s (ld -> link , ZSTR_VAL (ldap_base_dn ), scope , ZSTR_VAL (ldap_filter ), ldap_attrs , ldap_attrsonly , lserverctrls , NULL , NULL , ldap_sizelimit , & ldap_res );
17831783
1784- if (errno != LDAP_SUCCESS
1785- && errno != LDAP_SIZELIMIT_EXCEEDED
1784+ if (ldap_errno != LDAP_SUCCESS
1785+ && ldap_errno != LDAP_SIZELIMIT_EXCEEDED
17861786#ifdef LDAP_ADMINLIMIT_EXCEEDED
1787- && errno != LDAP_ADMINLIMIT_EXCEEDED
1787+ && ldap_errno != LDAP_ADMINLIMIT_EXCEEDED
17881788#endif
17891789#ifdef LDAP_REFERRAL
1790- && errno != LDAP_REFERRAL
1790+ && ldap_errno != LDAP_REFERRAL
17911791#endif
17921792 ) {
17931793 /* ldap_res should be freed regardless of return value of ldap_search_ext_s()
17941794 * see: https://linux.die.net/man/3/ldap_search_ext_s */
17951795 if (ldap_res != NULL ) {
17961796 ldap_msgfree (ldap_res );
17971797 }
1798- php_error_docref (NULL , E_WARNING , "Search: %s" , ldap_err2string (errno ));
1798+ php_error_docref (NULL , E_WARNING , "Search: %s" , ldap_err2string (ldap_errno ));
17991799 ret = 0 ;
18001800 } else {
1801- if (errno == LDAP_SIZELIMIT_EXCEEDED ) {
1801+ if (ldap_errno == LDAP_SIZELIMIT_EXCEEDED ) {
18021802 php_error_docref (NULL , E_WARNING , "Partial search results returned: Sizelimit exceeded" );
18031803 }
18041804#ifdef LDAP_ADMINLIMIT_EXCEEDED
1805- else if (errno == LDAP_ADMINLIMIT_EXCEEDED ) {
1805+ else if (ldap_errno == LDAP_ADMINLIMIT_EXCEEDED ) {
18061806 php_error_docref (NULL , E_WARNING , "Partial search results returned: Adminlimit exceeded" );
18071807 }
18081808#endif
@@ -3038,7 +3038,7 @@ PHP_FUNCTION(ldap_compare)
30383038 size_t dn_len , attr_len , value_len ;
30393039 ldap_linkdata * ld ;
30403040 LDAPControl * * lserverctrls = NULL ;
3041- int errno ;
3041+ int ldap_errno ;
30423042 struct berval lvalue ;
30433043
30443044 if (zend_parse_parameters (ZEND_NUM_ARGS (), "Osss|a!" , & link , ldap_link_ce , & dn , & dn_len , & attr , & attr_len , & value , & value_len , & serverctrls ) != SUCCESS ) {
@@ -3059,9 +3059,9 @@ PHP_FUNCTION(ldap_compare)
30593059 lvalue .bv_val = value ;
30603060 lvalue .bv_len = value_len ;
30613061
3062- errno = ldap_compare_ext_s (ld -> link , dn , attr , & lvalue , lserverctrls , NULL );
3062+ ldap_errno = ldap_compare_ext_s (ld -> link , dn , attr , & lvalue , lserverctrls , NULL );
30633063
3064- switch (errno ) {
3064+ switch (ldap_errno ) {
30653065 case LDAP_COMPARE_TRUE :
30663066 RETVAL_TRUE ;
30673067 break ;
@@ -3071,7 +3071,7 @@ PHP_FUNCTION(ldap_compare)
30713071 break ;
30723072
30733073 default :
3074- php_error_docref (NULL , E_WARNING , "Compare: %s" , ldap_err2string (errno ));
3074+ php_error_docref (NULL , E_WARNING , "Compare: %s" , ldap_err2string (ldap_errno ));
30753075 RETVAL_LONG (-1 );
30763076 }
30773077
0 commit comments