|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59234 Segmentation fault on calling error() of a fresh worker
Submitted: 2010-05-27 05:59 UTC Modified: 2011-05-15 03:20 UTC
From: kelfe at gmx dot de Assigned: hradtke (profile)
Status: Closed Package: gearman (PECL)
PHP Version: 5.2.13 OS: Gentoo x86 and x86_64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: kelfe at gmx dot de
New email:
PHP Version: OS:


 [2010-05-27 05:59 UTC] kelfe at gmx dot de
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-06 12:46 UTC] jiayong dot ou at ymc dot ch
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, 

--- 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;
-	RETURN_STRING((char *)gearman_worker_error(&(obj-
>worker)), 1);
+	error = (char *)gearman_worker_error(&(obj-
+	if (error) {
+		RETURN_STRING(error, 1)
+	} 
 /* }}} */
 [2011-01-06 12:49 UTC] jiayong dot ou at ymc dot ch
Bug tracker f'd up the formatting of the patch. Here it is on 
 [2011-05-15 03:20 UTC]
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 04:01:28 2024 UTC