Publero/net_gearman — pull request #16 by danbruce (2014-12-11 21:38:19+00:00)
Title: Base64 encode strings before handing them off to Gearman.

Strings that contain null-bytes cannot be properly passed off to Gearman. For example:

```php
addServer('localhost', 4730);
$data = 'test'."\0".'string';
echo 'Sent: '.$data.PHP_EOL;
$client->doBackground('nullString', $data);
```

```php
addServer('localhost', 4730);
$worker->addFunction('nullString', function($data) {
echo 'Received: '.$data.PHP_EOL;
return true;
});
$worker->work();
```

```shell
$> php client.php
Sent: teststring
```

```shell
$> php worker.php
Received: test
```

This patch uses `base64_encode` and `base64_decode` to transparently ensure that the string sent from the client arrives at the workload identically.