- Added proper destructors for resources and custom types
[lwes-php.git] / tests / sigsegv.phpt
blob2930f56c3af641c7b67ab111555cb353983986cc
1 --TEST--
2 Segmentation fault when in-use event type is destroyed before emitting an event
3 --SKIPIF--
4 <?php if (!extension_loaded("lwes")) print "skip"; ?>
5 --FILE--
6 <?php 
8 $emitter = lwes_emitter_create("127.0.0.1", NULL, 12345, 1, 60); 
9 var_dump($emitter);
10 $db = lwes_event_type_db_create(dirname(__FILE__).'/testcomplex.esf'); 
11 var_dump($db);
12 $event  = lwes_event_create_with_encoding($db, "UserLogin", 1); 
13 var_dump($event);
15 // Destroy beforehand
16 lwes_event_type_db_destroy($db); 
18 lwes_event_set_STRING($event, "username",  "bob"); 
19 lwes_event_set_U_INT_32($event, "password",  0xdeadbeef); 
20 lwes_event_set_IP_ADDR_w_string($event, "clientIP",  "127.0.0.1"); 
21 lwes_event_set_BOOLEAN($event, "successful", 0); 
23 lwes_emitter_emit($emitter, $event); 
26 --EXPECT--
27 resource(4) of type (_p_lwes_emitter)
28 resource(5) of type (_p_lwes_event_type_db)
29 resource(6) of type (_p_lwes_event)