PHP 4.0 Bug #6616 Updated: ext/java: reassigning values for variables causes segfault

From: Date: Tue, 30 Jan 2001 08:46:23 +0000
Subject: PHP 4.0 Bug #6616 Updated: ext/java: reassigning values for variables causes segfault
Groups: php.dev 
Request: Send a blank email to php-dev+get-45312@lists.php.net to get a copy of this message
ID: 6616 Updated by: sniper Reported By: bridge@gsnet.com Old-Status: Feedback Status: Closed Bug Type: Unknown/Other Function Assigned To: Comments: If the problem persists with latest CVS snapshot reopen this bug report. --Jani Previous Comments: --------------------------------------------------------------------------- [2000-12-30 12:14:40] sniper@php.net Have you tried PHP 4.0.4 ? Does this happen with it too? --Jani --------------------------------------------------------------------------- [2000-11-21 03:30:40] sniper@php.net Does this happen with PHP 4.0.3pl1 or preferrably with the latest snapshot from http://snaps.php.net/ ? --Jani --------------------------------------------------------------------------- [2000-09-13 01:43:59] bridge@gsnet.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-09-08 12:00:44] bridge@gsnet.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-07 17:53:04] bridge@gsnet.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("<i>".$j."=".$aStrings[$j]."</i><br>n"); } print("<br>"); print("Here it is again:<br>n"); $aStrings=$jTest->getAnArrayOfStrings(); for($j=0; $j<sizeof($aStrings); $j++) { print("<i>".$j."=".$aStrings[$j]."</i><br>n"); } ?> Here's the Java code from PHPTest.java 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: [java] java.class.path=/usr/local/lib/php_java.jar:/home/bridge/gsnlib/classes:/usr/local/lib/php_java.jar:/home/bridge/externlib:/home/bridge/externlib/Una_Enterprise.zip java.library.path=/home/bridge/externlib/modules java.library=/usr/local/jdk1.2.2-RC4/jre/lib/i386/libjava.so extension_dir=/home/bridge/externlib/modules extension=libphp_java.so From php-4.0.2's config.status: ./configure --with-apxs=/usr/local/apache/bin/apxs --with-java --with-mysql --------------------------------------------------------------------------- The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online. Full Bug description available at: http://bugs.php.net/?id=6616

« previous php.dev (#45312) next »