Bug #9507 Updated: Java Classes and session_register
| From: | sbergmann@php.net | Date: | Fri, 22 Jun 2001 06:22:17 +0000 |
| Subject: | Bug #9507 Updated: Java Classes and session_register | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-57635@lists.php.net to get a copy of this message | ||
ID: 9507
Updated by: sbergmann
Reported By: geograf@geograf.pt
Old-Status: Open
Status: Analyzed
Bug Type: Java related
Operating system:
PHP Version: 4.0.4pl1
Assigned To:
Comments:
<?php
session_start();
if (!session_is_registered("system")) {
$system = null;
$system = new Java("java.lang.System");
session_register("system");
}
print $system->getProperty("java.version");
?>
The above code works upon first request, but gives a
Warning: java.lang.NullPointerException in
e:\server\htdocs\test.php on line 10
in subsequent requests.
After commenting out the session_start() call it works fine, which is weird IMHO since
session_register() implictly calls session_start().
Tested with PHP 4.0.7-dev (latest CVS), Java 2 SDK 1.3, Java HotSport Server VM 2.0.
Previous Comments:
---------------------------------------------------------------------------
[2001-03-01 04:30:15] geograf@geograf.pt
Hi,
I'm trying to save a Java class into a
session variable like the code bellow:
if ( !session_is_registered( "objJC" ) )
{
$objJC = null;
$objJC = new Java( "JavaClass" );
session_register( "objJC" );
}
This code works for the 1st time, when the
session var 'objJC' is registered for the 1st time. All the methods of the java class can
be accessed.
The next times the variable 'objJC' already exists, as a session var, but i cannot access
the methods inside, and gives me the
error message like:
Warning: java.lang.NoSuchMethodException: doinitmapj in c:program filesapache
groupapachehtdocsphpphp_mapxt.php on line 71
When you do this with a normal PHP class, using include() or required( ), everything works ok.
It seems that the registration doesn't keep the class type as a Java Class.
Can someone help me with this?
Than you very much in advance.
Carlos Figueiredo
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9507&edit=2