php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #42060
Patch paged-ldap-5.3 revision 2011-04-28 23:00 UTC by bryant dot david at gmail dot com
Patch api-rename.patch revision 2010-11-04 21:16 UTC by jeanseb at au-fil-du dot net
Patch php-trunk_ldap-pagination.patch revision 2010-11-04 20:47 UTC by jeanseb at au-fil-du dot net
revision 2010-11-03 21:50 UTC by jeanseb at au-fil-du dot net
revision 2010-05-21 15:27 UTC by jeanseb at au-fil-du dot net
Patch ext-ldap-review.patch revision 2010-08-04 15:54 UTC by jeanseb at au-fil-du dot net

Patch php-trunk_ldap-pagination.patch for *General Issues Bug #42060

Patch version 2010-11-03 21:50 UTC

Return to Bug #42060 | Download this patch
This patch is obsolete

Obsoleted by patches:

This patch renders other patches obsolete

Obsolete patches:

Patch Revisions: 2010-11-04 20:47 UTC | 2010-11-03 21:50 UTC | 2010-05-21 15:27 UTC

Developer: jeanseb@au-fil-du.net



   /* }}} */
   #endif
  +
  +#ifdef LDAP_CONTROL_PAGEDRESULTS
 +/* {{{ proto bool ldap_ctrl_paged_results(resource link, int pagesize [, bool iscritical [, string cookie]])
 +/* {{{ proto bool ldap_control_paged_results(resource link, int pagesize [, bool iscritical [, string cookie]])
  +   Inject paged results control*/
 +PHP_FUNCTION(ldap_ctrl_paged_results) 
 +PHP_FUNCTION(ldap_control_paged_results) 
  +{
 +	int pagesize;
 +	int iscritical;
 +	long pagesize;
 +	zend_bool iscritical;
  +	zval *link, *cookie;
  +	struct berval lcookie = { 0, NULL };
  +	ldap_linkdata *ld;
  +	LDAP *ldap;


  +			lcookie.bv_val = Z_STRVAL_PP(&cookie);
  +			lcookie.bv_len = Z_STRLEN_PP(&cookie);
  +			/* fallthru */
  +		case 3:
 +			ctrl.ldctl_iscritical = iscritical;
 +			ctrl.ldctl_iscritical = (int)iscritical;
  +			/* fallthru */
  +	}
  +
 +	if (ber_printf(ber, "{iO}", pagesize, &lcookie) == LBER_ERROR) {
 +	if (ber_printf(ber, "{iO}", (int)pagesize, &lcookie) == LBER_ERROR) {
  +		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to BER printf paged results control");
  +		RETVAL_BOOL(0);
  +		goto lcpr_error_out;
  +	}


  +	return;
  +}
  +/* }}} */
  +
 +/* {{{ proto bool ldap_ctrl_paged_results_resp(resource link, resource result [, string cookie [, int estimated]])
 +/* {{{ proto bool ldap_control_paged_results_response(resource link, resource result [, string cookie [, int estimated]])
  +   Extract paged results control response */
 +PHP_FUNCTION(ldap_ctrl_paged_results_resp) 
 +PHP_FUNCTION(ldap_control_paged_results_response) 
  +{
  +	zval *link, *result, *cookie, *estimated;
  +	struct berval lcookie;
  +	int lestimated;


   	ZEND_ARG_INFO(1, referrals)
   ZEND_END_ARG_INFO()
   #endif
  +
 +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_ctrl_paged_results, 0, 0, 2)
 +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_results, 0, 0, 2)
  +	ZEND_ARG_INFO(0, link)
  +	ZEND_ARG_INFO(0, pagesize)
  +	ZEND_ARG_INFO(0, iscritical)
  +	ZEND_ARG_INFO(0, cookie)
  +ZEND_END_ARG_INFO();
  +
 +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_ctrl_paged_results_resp, 0, 0, 2)
 +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_results_response, 0, 0, 2)
  +	ZEND_ARG_INFO(0, link)
  +	ZEND_ARG_INFO(0, result)
  +	ZEND_ARG_INFO(1, cookie)
  +	ZEND_ARG_INFO(1, estimated)


   	PHP_FE(ldap_start_tls,								arginfo_ldap_resource)
   #endif
  +
  +#ifdef LDAP_CONTROL_PAGEDRESULTS
 +	PHP_FE(ldap_ctrl_paged_results,							arginfo_ldap_ctrl_paged_results)
 +	PHP_FE(ldap_ctrl_paged_results_resp,						arginfo_ldap_ctrl_paged_results_resp)
 +	PHP_FE(ldap_control_paged_results,							arginfo_ldap_control_paged_results)
 +	PHP_FE(ldap_control_paged_results_response,						arginfo_ldap_control_paged_results_response)
   #endif
   
  +#endif
  +
   #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
   	PHP_FE(ldap_set_rebind_proc,						arginfo_ldap_set_rebind_proc)
   #endif
 Index: ext/ldap/tests/ldap_ctrl_paged_results_variation1.phpt
 Index: ext/ldap/tests/ldap_control_paged_results_variation1.phpt
  ===================================================================
 --- ext/ldap/tests/ldap_ctrl_paged_results_variation1.phpt	(révision 0)
 +++ ext/ldap/tests/ldap_ctrl_paged_results_variation1.phpt	(révision 40105)
 --- ext/ldap/tests/ldap_control_paged_results_variation1.phpt	(révision 0)
 +++ ext/ldap/tests/ldap_control_paged_results_variation1.phpt	(révision 40105)
  @@ -0,0 +1,56 @@
  +--TEST--
 +ldap_ldap_ctrl_paged_results() test (fetching the first page)
 +ldap_ldap_control_paged_results() test (fetching the first page)
  +--CREDITS--
  +Jean-Sebastien Hedde <jeanseb@au-fil-du.net>
  +--SKIPIF--
  +<?php


  +
  +$dn = "dc=my-domain,dc=com";
  +$filter = "(cn=*)";
  +var_dump(
 +	ldap_ctrl_paged_results($link, 1),
 +	ldap_control_paged_results($link, 1),
  +	$result = ldap_search($link, $dn, $filter, array('cn')),
  +	ldap_get_entries($link, $result)
  +);
  +?>


  +    string(28) "cn=userA,dc=my-domain,dc=com"
  +  }
  +}
  +===DONE===
 Index: ext/ldap/tests/ldap_ctrl_paged_results_variation2.phpt
 Index: ext/ldap/tests/ldap_control_paged_results_variation2.phpt
  ===================================================================
 --- ext/ldap/tests/ldap_ctrl_paged_results_variation2.phpt	(révision 0)
 +++ ext/ldap/tests/ldap_ctrl_paged_results_variation2.phpt	(révision 40105)
 --- ext/ldap/tests/ldap_control_paged_results_variation2.phpt	(révision 0)
 +++ ext/ldap/tests/ldap_control_paged_results_variation2.phpt	(révision 40105)
  @@ -0,0 +1,72 @@
  +--TEST--
 +ldap_ldap_ctrl_paged_results() test (fetching the first page with a pagesize=2)
 +ldap_ldap_control_paged_results() test (fetching the first page with a pagesize=2)
  +--CREDITS--
  +Jean-Sebastien Hedde <jeanseb@au-fil-du.net>
  +--SKIPIF--
  +<?php


  +
  +$dn = "dc=my-domain,dc=com";
  +$filter = "(cn=*)";
  +var_dump(
 +	ldap_ctrl_paged_results($link, 2),
 +	ldap_control_paged_results($link, 2),
  +	$result = ldap_search($link, $dn, $filter, array('cn')),
  +	ldap_get_entries($link, $result)
  +);
  +?>


  +    string(28) "cn=userB,dc=my-domain,dc=com"
  +  }
  +}
  +===DONE===
 Index: ext/ldap/tests/ldap_ctrl_paged_results_variation3.phpt
 Index: ext/ldap/tests/ldap_control_paged_results_variation3.phpt
  ===================================================================
 --- ext/ldap/tests/ldap_ctrl_paged_results_variation3.phpt	(révision 0)
 +++ ext/ldap/tests/ldap_ctrl_paged_results_variation3.phpt	(révision 40105)
 --- ext/ldap/tests/ldap_control_paged_results_variation3.phpt	(révision 0)
 +++ ext/ldap/tests/ldap_control_paged_results_variation3.phpt	(révision 40105)
  @@ -0,0 +1,100 @@
  +--TEST--
 +ldap_ldap_ctrl_paged_results() test (fetching the first page then the next final page)
 +ldap_ldap_control_paged_results() test (fetching the first page then the next final page)
  +--CREDITS--
  +Jean-Sebastien Hedde <jeanseb@au-fil-du.net>
  +--SKIPIF--
  +<?php


  +$dn = "dc=my-domain,dc=com";
  +$filter = "(cn=*)";
  +$cookie = '';
  +var_dump(
 +	ldap_ctrl_paged_results($link, 2, true, $cookie),
 +	ldap_control_paged_results($link, 2, true, $cookie),
  +	$result = ldap_search($link, $dn, $filter, array('cn')),
  +	ldap_get_entries($link, $result),
 +	ldap_ctrl_paged_results_resp($link, $result, $cookie),
 +	ldap_ctrl_paged_results($link, 20, true, $cookie),
 +	ldap_control_paged_results_response($link, $result, $cookie),
 +	ldap_control_paged_results($link, 20, true, $cookie),
  +	$result = ldap_search($link, $dn, $filter, array('cn')),
  +	ldap_get_entries($link, $result)
  +);
  +?>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 09:01:29 2024 UTC