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. --EXTENSIONS--
  6. ldap
  7. --SKIPIF--
  8. <?php require_once('skipifbindfailure.inc'); ?>
  9. <?php
  10. require_once('skipifcontrol.inc');
  11. skipifunsupportedcontrol(LDAP_CONTROL_POST_READ);
  12. ?>
  13. --FILE--
  14. <?php
  15. require "connect.inc";
  16. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  17. var_dump(
  18. $result = ldap_add_ext($link, "o=test_ldap_add_ext,$base", array(
  19. "objectClass" => array(
  20. "top",
  21. "organization"),
  22. "o" => "test_ldap_add_ext",
  23. ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]),
  24. ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
  25. $errcode,
  26. $errmsg,
  27. $ctrls[LDAP_CONTROL_POST_READ],
  28. ldap_get_entries(
  29. $link,
  30. ldap_search($link, "$base", "(o=test_ldap_add_ext)")
  31. )
  32. );
  33. ?>
  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. object(LDAP\Result)#%d (0) {
  42. }
  43. bool(true)
  44. int(0)
  45. string(0) ""
  46. array(2) {
  47. ["oid"]=>
  48. string(14) "1.3.6.1.1.13.2"
  49. ["value"]=>
  50. array(2) {
  51. ["dn"]=>
  52. string(%d) "o=test_ldap_add_ext,%s"
  53. ["o"]=>
  54. array(1) {
  55. [0]=>
  56. string(17) "test_ldap_add_ext"
  57. }
  58. }
  59. }
  60. array(2) {
  61. ["count"]=>
  62. int(1)
  63. [0]=>
  64. array(6) {
  65. ["objectclass"]=>
  66. array(3) {
  67. ["count"]=>
  68. int(2)
  69. [0]=>
  70. string(3) "top"
  71. [1]=>
  72. string(12) "organization"
  73. }
  74. [0]=>
  75. string(11) "objectclass"
  76. ["o"]=>
  77. array(2) {
  78. ["count"]=>
  79. int(1)
  80. [0]=>
  81. string(17) "test_ldap_add_ext"
  82. }
  83. [1]=>
  84. string(1) "o"
  85. ["count"]=>
  86. int(2)
  87. ["dn"]=>
  88. string(%d) "o=test_ldap_add_ext,%s"
  89. }
  90. }