|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58884 Returning empty string from static function causes seg fault
Submitted: 2009-10-08 16:49 UTC Modified: 2010-02-20 15:35 UTC
From: scottsteffens at gmail dot com Assigned:
Status: Duplicate Package: spidermonkey (PECL)
PHP Version: 5.3.0RC4 OS: linux
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: scottsteffens at gmail dot com
New email:
PHP Version: OS:


 [2009-10-08 16:49 UTC] scottsteffens at gmail dot com
When a registered class accesses a static function that returns an empty string "", it results in a segmentation fault.

This bug appears to be distinct from #16865 since it likely has to do with type conversion, but all the software and environment settings are the same.

Reproduce code:
$app = new App();

class App {	
	public function run () {
		$context = new JSContext();
		$context->registerClass( 'TimeObject' );
		echo $context->evaluateScript( 'var t = new TimeObject(); t.getTime();' );
	static function getString() {
		return ''; // <-- empty string causes seg fault
		//return ' '; // <-- a space won't cause seg fault

class TimeObject {
	public function getTime () {
		return App::getString();

Expected result:
getTime() returns an empty string

Actual result:
Apache error_log:
[Thu Oct 08 13:43:29 2009] [notice] child pid 5629 exit signal Segmentation fault (11)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-27 10:39 UTC] drslump at pollinimini dot net
This use case seems to also be fixed by the patch supplied in bug 16876 (
 [2010-02-20 15:35 UTC] c dot robin at smartphp dot org
It is indeed fixed by the corrective used for 16876
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 15:01:32 2024 UTC