Skip to content

Commit

Permalink
fix: try to fix GH PR andreiz#31
Browse files Browse the repository at this point in the history
  • Loading branch information
Timandes committed Jan 22, 2019
1 parent 10b3174 commit 20abe78
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Version 0.6.3
Bugs:
* Correct exception message (From "Failed to connect to Zookeeper" to "Failed to initialize ZooKeeper ...", Issue #29)
* Fix 'duplicate symbol _php_zk_config_ce'
* Fix segmentation fault when destroying Zookeeper instance (GH PR #31)

Version 0.6.2
-------------
Expand Down
3 changes: 1 addition & 2 deletions php_zookeeper.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,8 @@ zend_object* php_zk_new(zend_class_entry *ce TSRMLS_DC)
{
php_zk_t *i_obj;

i_obj = ecalloc(1, sizeof(*i_obj));
i_obj = ecalloc(1, sizeof(php_zk_t) + zend_object_properties_size(ce));
zend_object_std_init( &i_obj->zo, ce TSRMLS_CC );
object_properties_init(&i_obj->zo, ce);
i_obj->zo.handlers = &zookeeper_obj_handlers;

zend_hash_init_ex(&i_obj->callbacks, 5, NULL, (dtor_func_t)php_cb_data_zv_destroy, 0, 0);
Expand Down
28 changes: 28 additions & 0 deletions tests/gh-pr-31.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--TEST--
php-zookeeper/php-zookeeper's PR #31
--SKIPIF--
<?php
if (!extension_loaded('zookeeper')) {
echo 'skip ZooKeeper extension is not loaded';
}
?>
--FILE--
<?php
function create($key)
{
$store = new \Zookeeper('127.0.0.1:2181');
$store->create(
$key,
'',
[[ 'perms' => \Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone' ]],
\Zookeeper::EPHEMERAL
);
}

create('/' . uniqid());
create('/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' . uniqid());

echo 'OK';

--EXPECT--
OK

0 comments on commit 20abe78

Please sign in to comment.