问题
I am using famous PHP-JAVA bridge and I get this error in Java.inc file.I made a property named $protocol in class java_Client and I'm still getting this error. Anybody knows how to fix it?
回答1:
Assuming you want to fix the missing properties and not discard the display of the E_NOTICE via error_reporting(error_reporting() & ~E_NOTICE)
(which could be harmful)
Option 1 Fixing missing properties in Java.inc
If you try to fix missing properties on the Java.inc file and the error still appears, it's probably because you are still loading the remote file. You can check if a remote loading is made by looking for initialization sequence:
include_once 'http://localhost:8080/JavaBridge/java/Java.inc';
If it's the case, make a local copy of the 'Java.inc' php code content (wget http://localhost:8080/JavaBridge/java/Java.inc
), apply your fixes and require the local file instead of the remote one:
require_once '/my/local/path/RefactoredJava.inc.php';
(If you already done those steps and face the same error message, you might also have a problem with your opcache, ensure file is reloaded)
Option 2 Use the soluble/japha
client instead ?
You can have a look to soluble-japha repo on Gitub which provides an alternative java bridge client (with fixes for undefined properties as well as many other changes).
The soluble-japha API is not backward compatible, but you can install a legacy compatibility wrapper which expose most of the original java_*()
global functions.
Disclaimer: It's not and official client, just a rework I did some years ago and decided to opensource.
来源:https://stackoverflow.com/questions/38651573/how-to-fix-notice-undefined-property-java-clientprotocol-in-http-local