|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6616 ext/java: reassigning values for variables causes segfault
Submitted: 2000-09-07 17:53 UTC Modified: 2001-01-30 03:46 UTC
From: bridge at gsnet dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.2 OS: RH Linux 6.1/Apache1.3.12
Private report: No CVE-ID: None
 [2000-09-07 17:53 UTC] bridge at gsnet dot com
If I call a java object twice from PHP-4.0.2 and assign the result 
to the same variable, it generates a segmentation fault 
(under both ibm-jdk118 and Blackdown JDK1.2.2-RC4).  If I 
change the second occurrence of "aStrings" to, say, "aStrings2" 
it works fine. 

Note that to reproduce this problem, you may need
to reload it more than once.  It crashes about as many times as
it works on my configuration.

Heres' the PHP code:


  $jTest = new Java("PHPTest");

  print("Here is an Array of Strings:<br>\n");

  $aStrings = $jTest->getAnArrayOfStrings();

  for($j=0; $j<sizeof($aStrings); $j++) {       

  print("Here it is again:<br>\n");

  for($j=0; $j<sizeof($aStrings); $j++) {  


Here's the Java code from

public class PHPTest {

  public String getAString() {
    return "This is a String";

  public String[] getAnArrayOfStrings() {
    return new String[]{"Element 1", "Element 2", "Element 3", "Element 4"};


The non-default part of my php.ini:

From php-4.0.2's config.status:
./configure  --with-apxs=/usr/local/apache/bin/apxs --with-java --with-mysql


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-08 12:00 UTC] bridge at gsnet dot com
Hmmm....  Although it doesn't crash as much when I don't reassign values to 
variables which hold results from java calls, it still dumps core occasionally.... :(

 [2000-09-13 01:43 UTC] bridge at gsnet dot com
A workaround is to avoid using arrays altogether.  
Array data can be transferred from java to php 
as a String using implode/explode.
 [2000-11-21 03:30 UTC]
Does this happen with PHP 4.0.3pl1 or preferrably
with the latest snapshot from ?

 [2000-12-30 12:14 UTC]
Have you tried PHP 4.0.4 ? Does this happen with it too?

 [2001-01-30 03:46 UTC]
If the problem persists with latest CVS snapshot
reopen this bug report.


PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 00:01:30 2024 UTC