@@ -1448,25 +1448,24 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
14481448 zend_string * base_dn_str = NULL ;
14491449 HashTable * filter_ht = NULL ;
14501450 zend_string * filter_str = NULL ;
1451- zend_long sizelimit = 0 , timelimit = 0 , deref = LDAP_DEREF_NEVER ;
1452- bool attrsonly = false ;
1451+ zend_long sizelimit = -1 , timelimit = -1 , deref = LDAP_DEREF_NEVER ;
1452+ zend_long attrsonly = 0 ;
14531453 HashTable * server_controls_ht = NULL ;
14541454 char * * ldap_attrs = NULL ;
14551455 ldap_linkdata * ld = NULL ;
14561456 ldap_resultdata * result ;
14571457 LDAPMessage * ldap_res = NULL ;
14581458 LDAPControl * * lserverctrls = NULL ;
1459- int ldap_attrsonly = 0 , ldap_sizelimit = -1 , ldap_timelimit = -1 , ldap_deref = -1 ;
14601459 int old_ldap_sizelimit = -1 , old_ldap_timelimit = -1 , old_ldap_deref = -1 ;
1461- int ret = 1 , ldap_errno , argcount = ZEND_NUM_ARGS () ;
1460+ int ret = 1 , ldap_errno ;
14621461
14631462 ZEND_PARSE_PARAMETERS_START (3 , 9 )
14641463 Z_PARAM_ZVAL (link )
14651464 Z_PARAM_ARRAY_HT_OR_STR (base_dn_ht , base_dn_str )
14661465 Z_PARAM_ARRAY_HT_OR_STR (filter_ht , filter_str )
14671466 Z_PARAM_OPTIONAL
14681467 Z_PARAM_ARRAY_EX (attrs , 0 , 1 )
1469- Z_PARAM_BOOL (attrsonly )
1468+ Z_PARAM_LONG (attrsonly )
14701469 Z_PARAM_LONG (sizelimit )
14711470 Z_PARAM_LONG (timelimit )
14721471 Z_PARAM_LONG (deref )
@@ -1488,25 +1487,6 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
14881487 RETURN_THROWS ();
14891488 }
14901489
1491- /* Reverse -> fall through */
1492- switch (argcount ) {
1493- case 9 :
1494- case 8 :
1495- ldap_deref = deref ;
1496- ZEND_FALLTHROUGH ;
1497- case 7 :
1498- ldap_timelimit = timelimit ;
1499- ZEND_FALLTHROUGH ;
1500- case 6 :
1501- ldap_sizelimit = sizelimit ;
1502- ZEND_FALLTHROUGH ;
1503- case 5 :
1504- ldap_attrsonly = attrsonly ? 1 : 0 ;
1505- ZEND_FALLTHROUGH ;
1506- default :
1507- break ;
1508- }
1509-
15101490 if (attrs ) {
15111491 const HashTable * attributes = Z_ARRVAL_P (attrs );
15121492 uint32_t num_attribs = zend_hash_num_elements (attributes );
@@ -1669,10 +1649,10 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
16691649 }
16701650 }
16711651
1672- php_set_opts (current_ld -> link , ldap_sizelimit , ldap_timelimit , ldap_deref , & old_ldap_sizelimit , & old_ldap_timelimit , & old_ldap_deref );
1652+ php_set_opts (current_ld -> link , ( int ) sizelimit , ( int ) timelimit , ( int ) deref , & old_ldap_sizelimit , & old_ldap_timelimit , & old_ldap_deref );
16731653
16741654 /* Run the actual search */
1675- ldap_search_ext (current_ld -> link , ZSTR_VAL (ldap_base_dn ), scope , ZSTR_VAL (ldap_filter ), ldap_attrs , ldap_attrsonly , lserverctrls , NULL , NULL , ldap_sizelimit , & rcs [ldap_link_index ]);
1655+ ldap_search_ext (current_ld -> link , ZSTR_VAL (ldap_base_dn ), scope , ZSTR_VAL (ldap_filter ), ldap_attrs , ( int ) attrsonly , lserverctrls , NULL , NULL , ( int ) sizelimit , & rcs [ldap_link_index ]);
16761656 lds [ldap_link_index ] = current_ld ;
16771657
16781658 // TODO Reset the options of the link?
@@ -1727,10 +1707,10 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
17271707 }
17281708 }
17291709
1730- php_set_opts (ld -> link , ldap_sizelimit , ldap_timelimit , ldap_deref , & old_ldap_sizelimit , & old_ldap_timelimit , & old_ldap_deref );
1710+ php_set_opts (ld -> link , ( int ) sizelimit , ( int ) timelimit , ( int ) deref , & old_ldap_sizelimit , & old_ldap_timelimit , & old_ldap_deref );
17311711
17321712 /* Run the actual search */
1733- ldap_errno = ldap_search_ext_s (ld -> link , ZSTR_VAL (base_dn_str ), scope , ZSTR_VAL (filter_str ), ldap_attrs , ldap_attrsonly , lserverctrls , NULL , NULL , ldap_sizelimit , & ldap_res );
1713+ ldap_errno = ldap_search_ext_s (ld -> link , ZSTR_VAL (base_dn_str ), scope , ZSTR_VAL (filter_str ), ldap_attrs , ( int ) attrsonly , lserverctrls , NULL , NULL , ( int ) sizelimit , & ldap_res );
17341714
17351715 if (ldap_errno != LDAP_SUCCESS
17361716 && ldap_errno != LDAP_SIZELIMIT_EXCEEDED
@@ -1768,7 +1748,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
17681748cleanup :
17691749 if (ld ) {
17701750 /* Restoring previous options */
1771- php_set_opts (ld -> link , old_ldap_sizelimit , old_ldap_timelimit , old_ldap_deref , & ldap_sizelimit , & ldap_timelimit , & ldap_deref );
1751+ php_set_opts (ld -> link , old_ldap_sizelimit , old_ldap_timelimit , old_ldap_deref , ( int * ) & sizelimit , ( int * ) & timelimit , ( int * ) & deref );
17721752 }
17731753 if (ldap_attrs != NULL ) {
17741754 efree (ldap_attrs );
0 commit comments