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_modify_batch_error.phpt ('ldap_modify_batch() - Batch modify operations 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:
$addGivenName = array(
7:     array(
8:         
"attrib"    => "givenName",
9:         
"modtype"    => LDAP_MODIFY_BATCH_ADD,
10:         
"values"    => array("Jack")
11:     )
12: );
13:
14:
// Too few parameters
15:
var_dump(ldap_modify_batch());
16:
var_dump(ldap_modify_batch($link));
17:
var_dump(ldap_modify_batch($link"$base"));
18:
19:
// Too many parameters
20:
var_dump(ldap_modify_batch($link"$base"$addGivenName, [], "Invalid additional parameter"));
21:
22:
// DN not found
23:
var_dump(ldap_modify_batch($link"cn=not-found,$base"$addGivenName));
24:
25:
// Invalid DN
26:
var_dump(ldap_modify_batch($link"weirdAttribute=val"$addGivenName));
27:
28:
// prepare
29:
$entry = array(
30:     
"objectClass"    => array(
31:         
"top",
32:         
"dcObject",
33:         
"organization"),
34:     
"dc"            => "my-domain",
35:     
"o"                => "my-domain",
36: );
37:
38:
ldap_add($link"dc=my-domain,$base"$entry);
39:
40:
// invalid domain
41:
$mods = array(
42:     array(
43:         
"attrib"    => "dc",
44:         
"modtype"    => LDAP_MODIFY_BATCH_REPLACE,
45:         
"values"    => array("Wrong Domain")
46:     )
47: );
48:
49:
var_dump(ldap_modify_batch($link"dc=my-domain,$base"$mods));
50:
51:
// invalid attribute
52:
$mods = array(
53:     array(
54:         
"attrib"    => "weirdAttribute",
55:         
"modtype"    => LDAP_MODIFY_BATCH_ADD,
56:         
"values"    => array("weirdVal""anotherWeirdval")
57:     )
58: );
59:
60:
var_dump(ldap_modify_batch($link"dc=my-domain,$base"$mods));
61:
?>
62:
===DONE===
63:

Expected

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

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

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

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

Warning: ldap_modify_batch(): Batch Modify: No such object in %s on line %d
bool(false)

Warning: ldap_modify_batch(): Batch Modify: Invalid DN syntax in %s on line %d
bool(false)

Warning: ldap_modify_batch(): Batch Modify: Naming violation in %s on line %d
bool(false)

Warning: ldap_modify_batch(): Batch Modify: Undefined attribute type in %s on line %d
bool(false)
===DONE===

Output

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

Diff

001+ Fatal error: Uncaught ArgumentCountError: ldap_modify_batch() expects at least 3 parameters, 0 given in /var/php_gcov/PHP_HEAD/ext/ldap/tests/ldap_modify_batch_error.php:15
002+ Stack trace:
003+ #0 /var/php_gcov/PHP_HEAD/ext/ldap/tests/ldap_modify_batch_error.php(15): ldap_modify_batch()
004+ #1 {main}
005+   thrown in /var/php_gcov/PHP_HEAD/ext/ldap/tests/ldap_modify_batch_error.php on line 15
001- Warning: ldap_modify_batch() expects at least 3 parameters, 0 given in %s on line %d
002- NULL
003- 
004- Warning: ldap_modify_batch() expects at least 3 parameters, 1 given in %s on line %d
005- NULL
006- 
007- Warning: ldap_modify_batch() expects at least 3 parameters, 2 given in %s on line %d
008- NULL
009- 
010- Warning: ldap_modify_batch() expects at most 4 parameters, 5 given in %s on line %d
011- NULL
012- 
013- Warning: ldap_modify_batch(): Batch Modify: No such object in %s on line %d
014- bool(false)
015- 
016- Warning: ldap_modify_batch(): Batch Modify: Invalid DN syntax in %s on line %d
017- bool(false)
018- 
019- Warning: ldap_modify_batch(): Batch Modify: Naming violation in %s on line %d
020- bool(false)
021- 
022- Warning: ldap_modify_batch(): Batch Modify: Undefined attribute type in %s on line %d
023- bool(false)
024- ===DONE===

 

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

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