PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/ldap/tests/ldap_add_error.phpt ('ldap_add() - Add operation that should fail')

Script

1: <?php
2:
require "connect.inc";
3:
4:
$link ldap_connect_and_bind($host$port$user$passwd$protocol_version);
5:
6:
// Too few parameters
7:
var_dump(ldap_add());
8:
var_dump(ldap_add($link));
9:
var_dump(ldap_add($link"$base"));
10:
11:
// Too many parameters
12:
var_dump(ldap_add($link"$base", array(), [], "Additional data"));
13:
14:
var_dump(ldap_add($link"$base", array()));
15:
16:
// Invalid DN
17:
var_dump(
18:     
ldap_add($link"weirdAttribute=val", array(
19:         
"weirdAttribute"            => "val",
20:     )),
21:     
ldap_error($link),
22:     
ldap_errno($link)
23: );
24:
25:
// Duplicate entry
26:
for ($i 0$i 2$i++)
27:     
var_dump(
28:     
ldap_add($link"dc=my-domain,$base", array(
29:       
"objectClass"    => array(
30:         
"top",
31:         
"dcObject",
32:         
"organization"),
33:       
"dc"            => "my-domain",
34:       
"o"                => "my-domain",
35:     ))
36:     );
37:
var_dump(ldap_error($link), ldap_errno($link));
38:
39:
// Wrong array indexes
40:
var_dump(
41:     
ldap_add($link"dc=my-domain2,dc=com", array(
42:         
"objectClass"    => array(
43:             
0    => "top",
44:             
2    => "dcObject",
45:             
5    => "organization"),
46:         
"dc"            => "my-domain",
47:         
"o"                => "my-domain",
48:     ))
49:     
/* Is this correct behaviour to still have "Already exists" as error/errno?
50:     ,
51:     ldap_error($link),
52:     ldap_errno($link)
53:     */
54:
);
55:
56:
// Invalid attribute
57:
var_dump(
58:     
ldap_add($link"$base", array(
59:         
"objectClass"    => array(
60:             
"top",
61:             
"dcObject",
62:             
"organization"),
63:         
"dc"            => "my-domain",
64:         
"o"                => "my-domain",
65:         
"weirdAttr"        => "weirdVal",
66:     )),
67:     
ldap_error($link),
68:     
ldap_errno($link)
69: );
70:
71:
var_dump(
72:     
ldap_add($link"$base", array(array( "Oops"
73:     
)))
74:     
/* Is this correct behaviour to still have "Undefined attribute type" as error/errno?
75:     ,
76:     ldap_error($link),
77:     ldap_errno($link)
78:     */
79:
);
80:
?>
81:
===DONE===
82:

Expected

Warning: ldap_add() expects at least 3 parameters, 0 given in %s on line %d
NULL

Warning: ldap_add() expects at least 3 parameters, 1 given in %s on line %d
NULL

Warning: ldap_add() expects at least 3 parameters, 2 given in %s on line %d
NULL

Warning: ldap_add() expects at most 4 parameters, 5 given in %s on line %d
NULL

Warning: ldap_add(): Add: Protocol error in %s on line %d
bool(false)

Warning: ldap_add(): Add: Invalid DN syntax in %s on line %d
bool(false)
string(17) "Invalid DN syntax"
int(34)
bool(true)

Warning: ldap_add(): Add: Already exists in %s on line %d
bool(false)
string(14) "Already exists"
int(68)

Warning: ldap_add(): Value array must have consecutive indices 0, 1, ... in %s on line %d
bool(false)

Warning: ldap_add(): Add: Undefined attribute type in %s on line %d
bool(false)
string(24) "Undefined attribute type"
int(17)

Warning: ldap_add(): Unknown attribute in the data in %s on line %d
bool(false)
===DONE===

Output

Fatal error: Uncaught ArgumentCountError: ldap_add() expects at least 3 parameters, 0 given in /var/php_gcov/PHP_HEAD/ext/ldap/tests/ldap_add_error.php:7
Stack trace:
#0 /var/php_gcov/PHP_HEAD/ext/ldap/tests/ldap_add_error.php(7): ldap_add()
#1 {main}
  thrown in /var/php_gcov/PHP_HEAD/ext/ldap/tests/ldap_add_error.php on line 7

Diff

001+ Fatal error: Uncaught ArgumentCountError: ldap_add() expects at least 3 parameters, 0 given in /var/php_gcov/PHP_HEAD/ext/ldap/tests/ldap_add_error.php:7
002+ Stack trace:
003+ #0 /var/php_gcov/PHP_HEAD/ext/ldap/tests/ldap_add_error.php(7): ldap_add()
004+ #1 {main}
005+   thrown in /var/php_gcov/PHP_HEAD/ext/ldap/tests/ldap_add_error.php on line 7
001- Warning: ldap_add() expects at least 3 parameters, 0 given in %s on line %d
002- NULL
003- 
004- Warning: ldap_add() expects at least 3 parameters, 1 given in %s on line %d
005- NULL
006- 
007- Warning: ldap_add() expects at least 3 parameters, 2 given in %s on line %d
008- NULL
009- 
010- Warning: ldap_add() expects at most 4 parameters, 5 given in %s on line %d
011- NULL
012- 
013- Warning: ldap_add(): Add: Protocol error in %s on line %d
014- bool(false)
015- 
016- Warning: ldap_add(): Add: Invalid DN syntax in %s on line %d
017- bool(false)
018- string(17) "Invalid DN syntax"
019- int(34)
020- bool(true)
021- 
022- Warning: ldap_add(): Add: Already exists in %s on line %d
023- bool(false)
024- string(14) "Already exists"
025- int(68)
026- 
027- Warning: ldap_add(): Value array must have consecutive indices 0, 1, ... in %s on line %d
028- bool(false)
029- 
030- Warning: ldap_add(): Add: Undefined attribute type in %s on line %d
031- bool(false)
032- string(24) "Undefined attribute type"
033- int(17)
034- 
035- Warning: ldap_add(): Unknown attribute in the data in %s on line %d
036- bool(false)
037- ===DONE===

 

Generated at Mon, 06 May 2019 17:58:35 +0000 (942 days ago)

Copyright © 2005-2021 The PHP Group
All rights reserved.