Skip to content
This repository has been archived by the owner on Jan 4, 2018. It is now read-only.

Calling context when not set segfaults #15

Closed
SpacePossum opened this issue Jul 14, 2016 · 12 comments
Closed

Calling context when not set segfaults #15

SpacePossum opened this issue Jul 14, 2016 · 12 comments

Comments

@SpacePossum
Copy link

$client = new \GearmanClient();
$client->context();
Segmentation fault (core dumped)
$ php -v
PHP 7.0.4-7ubuntu2.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
<?php var_dump(phpversion('gearman'));
// "2.0.0-dev"
@SpacePossum
Copy link
Author

Btw. also:

        $client = new \GearmanClient();
        $client->setContext('_test_');
        var_dump($client->context());
        die;
string(8) "_test_\000\000"

which is not expected

@SpacePossum
Copy link
Author

any interest?

@hjr3 hjr3 mentioned this issue Aug 29, 2016
@hjr3
Copy link
Owner

hjr3 commented Aug 29, 2016

@SpacePossum i saw this issue via mail and mistakenly thought it was part of the thread for php7 support. I asked in that thread if anyone has created. We do not have an official PHP7 release yet.

@SpacePossum
Copy link
Author

I'll close this one for now than and test when there is a RC for PHP7.
Thanks for the feedback! :)

@wcgallego
Copy link
Collaborator

@SpacePossum Current version is 2.0.1 on my branch (https://github.com/wcgallego/pecl-gearman).

Can you give that a shot?

@SpacePossum
Copy link
Author

SpacePossum commented Sep 15, 2016

I've cloned your repo @wcgallego, here are the results

$ sudo make install
/bin/bash /home/possum/work/pecl-gearman/pecl-gearman/libtool --mode=install cp ./gearman.la /home/possum/work/pecl-gearman/pecl-gearman/modules
libtool: install: cp ./.libs/gearman.so /home/possum/work/pecl-gearman/pecl-gearman/modules/gearman.so
libtool: install: cp ./.libs/gearman.lai /home/possum/work/pecl-gearman/pecl-gearman/modules/gearman.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /home/possum/work/pecl-gearman/pecl-gearman/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /home/possum/work/pecl-gearman/pecl-gearman/modules

[.. snip ...]
----------------------------------------------------------------------
Installing shared extensions:     /usr/lib/php/20151012/
$ php-config --extension-dir
/usr/lib/php/20151012
<?php

$client = new \GearmanClient();
$client->context();
$ php test.php 
Segmentation fault (core dumped)

screenshot from 2016-09-15 18-18-12

@SpacePossum
Copy link
Author

sorry for the late response, and the screenshot (select-copy seems to be disabled, I'll report that to Ubuntu ;))

@wcgallego
Copy link
Collaborator

Ah, makes sense. I think I see the problem.

Reopening, but look for the fix on my repo, @SpacePossum

@wcgallego wcgallego reopened this Sep 15, 2016
@SpacePossum
Copy link
Author

thanks and will do :)
let me know if I can help out, I haven't done much of C programming of PHP extensions lately but happy to pick it up again

@wcgallego
Copy link
Collaborator

@SpacePossum Should be fixed there, both on master and the 2.0.1 tag. Your test script and the test suite (aside from an integration test that was failing before) looking like they're working.

Can you let me know?

@SpacePossum
Copy link
Author

SpacePossum commented Sep 16, 2016

<?php

$client = new \GearmanClient();
$a = $client->context();
var_dump($a);
$client->setContext('_test_');
$a = $client->context();
var_dump($a);
$ php test.php 
/home/possum/work/pecl-gearman/pecl-gearman/test.php:5:
string(0) ""
/home/possum/work/pecl-gearman/pecl-gearman/test.php:8:
string(6) "_test_"
$ php -v
PHP 7.0.10-2+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.10-2+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans

All works as a charm now :)
Thanks @wcgallego !

@wcgallego
Copy link
Collaborator

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants