xref: /PHP-8.0/ext/enchant/tests/bug13181.phpt (revision c5401854)
1--TEST--
2bug #13181, leaving a context frees the broker resources
3--SKIPIF--
4<?php
5if (!extension_loaded('enchant')) {
6    echo "skip: Enchant extension not enabled\n";
7    exit;
8}
9
10$broker = enchant_broker_init();
11
12if (!$broker) {
13    echo "skip: Unable to init broker\n";
14    exit;
15}
16
17if (!enchant_broker_list_dicts($broker)) {
18    @enchant_broker_free($broker);
19
20    echo "skip: No broker dicts installed\n";
21}
22
23@enchant_broker_free($broker);
24?>
25--FILE--
26<?php
27function get_dictionnary() {
28    $rBroker = enchant_broker_init();
29    $t = enchant_broker_request_dict($rBroker, 'en');
30    var_dump($t);
31    return $t;
32}
33$rDict = get_dictionnary();
34var_dump($rDict);
35enchant_dict_suggest($rDict, "soong");
36
37function get_broker() {
38    $t = enchant_broker_init();
39    var_dump($t);
40    return $t;
41}
42
43$rbroker = get_broker();
44var_dump($rbroker);
45
46function get_dict($broker) {
47    $t = enchant_broker_request_dict($broker, 'en');
48    var_dump($t);
49    return $t;
50}
51$rDict = get_dict($rbroker);
52var_dump($rDict);
53?>
54--EXPECTF--
55object(EnchantDictionary)#%d (0) {
56}
57object(EnchantDictionary)#%d (0) {
58}
59object(EnchantBroker)#%d (0) {
60}
61object(EnchantBroker)#%d (0) {
62}
63object(EnchantDictionary)#%d (0) {
64}
65object(EnchantDictionary)#%d (0) {
66}
67
68