|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2023 The PHP Group
All rights reserved.
Last updated: Wed Dec 06 04:01:27 2023 UTC