|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-05-27 05:59 UTC] kelfe at gmx dot de
Description: ------------ fetching an error on a fresh worker produces a segmentation fault Reproduce code: --------------- php -r '$gmw=new GearmanWorker();echo $gmw->error();' Expected result: ---------------- no segmentation fault Actual result: -------------- php -r '$gmw=new GearmanWorker();echo $gmw->error();' Segmentation fault PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 14:00:01 2025 UTC |
Ran into the same bug. It occurs when calling GearmanWorker::error() when there's no error. In that case gearman_worker_error() returns NULL and RETURN_STRING doesn't like NULLs. That issues is fixed in GearmanClient::error(), so I changed GearmanWorker::error() to check for NULL first, too: --- php_gearman.c.orig 2011-01-06 18:37:07.000000000 +0100 +++ php_gearman.c 2011-01-06 18:38:48.000000000 +0100 @@ -3131,10 +3131,14 @@ PHP_FUNCTION(gearman_worker_error) { zval *zobj; gearman_worker_obj *obj; + char *error = NULL; GEARMAN_ZPMP(RETURN_NULL(), "", &zobj, gearman_worker_ce) - - RETURN_STRING((char *)gearman_worker_error(&(obj- >worker)), 1); + error = (char *)gearman_worker_error(&(obj- >worker)); + if (error) { + RETURN_STRING(error, 1) + } + RETURN_FALSE; } /* }}} */