ldap_add_ext.phpt 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. --TEST--
  2. ldap_add_ext() - Add operation with controls
  3. --CREDITS--
  4. Côme Chilliet <mcmic@php.net>
  5. --SKIPIF--
  6. <?php require_once('skipif.inc'); ?>
  7. <?php require_once('skipifbindfailure.inc'); ?>
  8. <?php
  9. require_once('skipifcontrol.inc');
  10. skipifunsupportedcontrol(LDAP_CONTROL_POST_READ);
  11. ?>
  12. --FILE--
  13. <?php
  14. require "connect.inc";
  15. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  16. var_dump(
  17. $result = ldap_add_ext($link, "o=test_ldap_add_ext,$base", array(
  18. "objectClass" => array(
  19. "top",
  20. "organization"),
  21. "o" => "test_ldap_add_ext",
  22. ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]),
  23. ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
  24. $errcode,
  25. $errmsg,
  26. $ctrls[LDAP_CONTROL_POST_READ],
  27. ldap_get_entries(
  28. $link,
  29. ldap_search($link, "$base", "(o=test_ldap_add_ext)")
  30. )
  31. );
  32. ?>
  33. ===DONE===
  34. --CLEAN--
  35. <?php
  36. require "connect.inc";
  37. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  38. ldap_delete($link, "o=test_ldap_add_ext,$base");
  39. ?>
  40. --EXPECTF--
  41. resource(%d) of type (ldap result)
  42. bool(true)
  43. int(0)
  44. string(0) ""
  45. array(2) {
  46. ["oid"]=>
  47. string(14) "1.3.6.1.1.13.2"
  48. ["value"]=>
  49. array(2) {
  50. ["dn"]=>
  51. string(%d) "o=test_ldap_add_ext,%s"
  52. ["o"]=>
  53. array(1) {
  54. [0]=>
  55. string(17) "test_ldap_add_ext"
  56. }
  57. }
  58. }
  59. array(2) {
  60. ["count"]=>
  61. int(1)
  62. [0]=>
  63. array(6) {
  64. ["objectclass"]=>
  65. array(3) {
  66. ["count"]=>
  67. int(2)
  68. [0]=>
  69. string(3) "top"
  70. [1]=>
  71. string(12) "organization"
  72. }
  73. [0]=>
  74. string(11) "objectclass"
  75. ["o"]=>
  76. array(2) {
  77. ["count"]=>
  78. int(1)
  79. [0]=>
  80. string(17) "test_ldap_add_ext"
  81. }
  82. [1]=>
  83. string(1) "o"
  84. ["count"]=>
  85. int(2)
  86. ["dn"]=>
  87. string(%d) "o=test_ldap_add_ext,%s"
  88. }
  89. }
  90. ===DONE===