summaryrefslogtreecommitdiff
path: root/ext/standard/tests/class_object/class_exists_basic_001.phpt
blob: bd930d8e51779e6ea8feb26b8317f84cb1740faa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--TEST--
Test class_exists() function : basic functionality
--FILE--
<?php
/* Prototype  : proto bool class_exists(string classname [, bool autoload])
 * Description: Checks if the class exists
 * Source code: Zend/zend_builtin_functions.c
 * Alias to functions:
 */

echo "*** Testing class_exists() : basic functionality ***\n";

function __autoload($className) {
	echo "In __autoload($className)\n";
}

echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n";
var_dump( class_exists('C', true) );
echo "\nCalling class_exists() on existing class with autoload explicitly enabled:\n";
var_dump( class_exists('stdclass', true) );

echo "\nCalling class_exists() on non-existent class with autoload explicitly enabled:\n";
var_dump( class_exists('D', false) );
echo "\nCalling class_exists() on existing class with autoload explicitly disabled:\n";
var_dump( class_exists('stdclass', false) );

echo "\nCalling class_exists() on non-existent class with autoload unspecified:\n";
var_dump( class_exists('E') );
echo "\nCalling class_exists() on existing class with autoload unspecified:\n";
var_dump( class_exists('stdclass') );

echo "Done";
?>
--EXPECTF--
*** Testing class_exists() : basic functionality ***
Calling class_exists() on non-existent class with autoload explicitly enabled:
In __autoload(C)
bool(false)

Calling class_exists() on existing class with autoload explicitly enabled:
bool(true)

Calling class_exists() on non-existent class with autoload explicitly enabled:
bool(false)

Calling class_exists() on existing class with autoload explicitly disabled:
bool(true)

Calling class_exists() on non-existent class with autoload unspecified:
In __autoload(E)
bool(false)

Calling class_exists() on existing class with autoload unspecified:
bool(true)
Done