Hi Andrey - sure.
As I mentioned above, I realize the error isn’t technically with Aspose. But I don’t believe Aspose will work with PHP 8.x+ unless JavaBridge works with PHP v8.x+. This issue prevents that.
According to the Aspose for PHP via Java installation guide, we first have to install JavaBridge in order to communicate with any Aspose for Java product from PHP code. If you install JavaBridge with PHP 8.1, the first call to initialize javabridge includes the java.inc file that comes packaged with JavaBridge:
However, that file, which is PHP code that gets executed, is not designed to work with PHP 8, and the javabridge project is not actively managed to provide an updated version.
java.inc file extends some PHP built-in classes and implements some PHP built-in interfaces, but does not correctly declare the base return types of those classes and interfaces. This became a requirement in PHP 8. So, as soon as you include and execute the
java.inc file as shown above, an error is apparent:
Fatal error: During inheritance of Iterator: Uncaught ErrorException: Return type of java_objectIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice.
There are a number of methods in that file that need to be updated in order for JavaBridge to work with PHP8+.
Again, I acknowledge that this is not an Aspose project per se, but if Aspose does want to remain compatible with PHP “7 or greater” as per the instructions, it might be nice if Aspose could provide a source
java.inc file that will work with the newer versions of PHP. Otherwise each customer has to modify individual pieces of the source java.inc file which is out of scope of the instructions provided.
Thanks for your consideration.