@@ -1448,25 +1448,24 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
1448
1448
zend_string * base_dn_str = NULL ;
1449
1449
HashTable * filter_ht = NULL ;
1450
1450
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 ;
1453
1453
HashTable * server_controls_ht = NULL ;
1454
1454
char * * ldap_attrs = NULL ;
1455
1455
ldap_linkdata * ld = NULL ;
1456
1456
ldap_resultdata * result ;
1457
1457
LDAPMessage * ldap_res = NULL ;
1458
1458
LDAPControl * * lserverctrls = NULL ;
1459
- int ldap_attrsonly = 0 , ldap_sizelimit = -1 , ldap_timelimit = -1 , ldap_deref = -1 ;
1460
1459
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 ;
1462
1461
1463
1462
ZEND_PARSE_PARAMETERS_START (3 , 9 )
1464
1463
Z_PARAM_ZVAL (link )
1465
1464
Z_PARAM_ARRAY_HT_OR_STR (base_dn_ht , base_dn_str )
1466
1465
Z_PARAM_ARRAY_HT_OR_STR (filter_ht , filter_str )
1467
1466
Z_PARAM_OPTIONAL
1468
1467
Z_PARAM_ARRAY_EX (attrs , 0 , 1 )
1469
- Z_PARAM_BOOL (attrsonly )
1468
+ Z_PARAM_LONG (attrsonly )
1470
1469
Z_PARAM_LONG (sizelimit )
1471
1470
Z_PARAM_LONG (timelimit )
1472
1471
Z_PARAM_LONG (deref )
@@ -1488,25 +1487,6 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
1488
1487
RETURN_THROWS ();
1489
1488
}
1490
1489
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
-
1510
1490
if (attrs ) {
1511
1491
const HashTable * attributes = Z_ARRVAL_P (attrs );
1512
1492
uint32_t num_attribs = zend_hash_num_elements (attributes );
@@ -1669,10 +1649,10 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
1669
1649
}
1670
1650
}
1671
1651
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 );
1673
1653
1674
1654
/* 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 ]);
1676
1656
lds [ldap_link_index ] = current_ld ;
1677
1657
1678
1658
// TODO Reset the options of the link?
@@ -1727,10 +1707,10 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
1727
1707
}
1728
1708
}
1729
1709
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 );
1731
1711
1732
1712
/* 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 );
1734
1714
1735
1715
if (ldap_errno != LDAP_SUCCESS
1736
1716
&& ldap_errno != LDAP_SIZELIMIT_EXCEEDED
@@ -1768,7 +1748,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
1768
1748
cleanup :
1769
1749
if (ld ) {
1770
1750
/* 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 );
1772
1752
}
1773
1753
if (ldap_attrs != NULL ) {
1774
1754
efree (ldap_attrs );
0 commit comments