andreiz / php-zookeeper

A PHP extension for interfacing with Apache ZooKeeper
Other
449 stars 215 forks source link

getChildren Fails #1

Closed roycamp closed 13 years ago

roycamp commented 13 years ago

getChildren() will fail if you pass null for the callback. Normally you would just omit the parameter but in the case you are extending the the Zookeeper class, your function ends up passing the variable as null.

$zk->getChildren('/test', null); //returns null $zk->getChildren('/test'); //returns array of znodes

This is what I was doing when I discovered the issue. If you omit $watcher_cb then its assigned value null, but since its passed in the parent call it silently breaks and returns NULL.

class zk extends Zookeeper { public function getChildren( $path, $watcher_cb = null) { return parent::getChildren( $path, $watcher_cb ); } }

andreiz commented 13 years ago

Closed by 4302bc0bbf51ca483669d694dd2bc7cce4838332.