diff --git a/composer.json b/composer.json index 3205b188..9fbc4caa 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Implement JVM by PHP", "type": "library", "license": "MIT", - "version": "0.0.9.0-dev", + "minimum-stability": "dev", "authors": [ { "name": "memory" @@ -15,12 +15,12 @@ "require": { "php": ">=7.3", "ext-zip": "*", - "monolog/monolog": "^1.24", + "monolog/monolog": "^2.2", "gabrielelana/byte-units": "^0.5.0", - "symfony/console": "^4.2", - "phpdocumentor/reflection-docblock": "^4.3", - "brick/math": "^0.8.8", - "nikic/php-parser": "^4.2" + "symfony/console": "^5.2", + "phpdocumentor/reflection-docblock": "^5.2", + "brick/math": "^0.9.1", + "nikic/php-parser": "^4.10" }, "autoload": { "psr-4": { @@ -34,10 +34,10 @@ } }, "require-dev": { - "phpunit/phpunit": "^8.0", - "squizlabs/php_codesniffer": "^3.4", - "friendsofphp/php-cs-fixer": "^2.14", - "brainmaestro/composer-git-hooks": "^2.6" + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.5", + "friendsofphp/php-cs-fixer": "^2.17", + "brainmaestro/composer-git-hooks": "^2.8" }, "scripts": { "test": "phpunit", diff --git a/src/Compiler/Lang/Assembler/Bundler/Packages/Constants.php b/src/Compiler/Lang/Assembler/Bundler/Packages/Constants.php index e09059c3..6441296b 100644 --- a/src/Compiler/Lang/Assembler/Bundler/Packages/Constants.php +++ b/src/Compiler/Lang/Assembler/Bundler/Packages/Constants.php @@ -44,12 +44,6 @@ class Constants extends AbstractPackageBundler implements PackageBundlerInterfac */ const PHP_VERSION_ID = PHP_VERSION_ID; - /** - * @var - * @export - */ - const PHP_EXTRA_VERSION = PHP_EXTRA_VERSION; - /** * @var \PHPJava\Packages\java\lang\String_ * @export diff --git a/src/Core/JavaArchive.php b/src/Core/JavaArchive.php index 324e1250..2224d499 100644 --- a/src/Core/JavaArchive.php +++ b/src/Core/JavaArchive.php @@ -110,6 +110,9 @@ public function __construct(string $jarFile, array $options = []) if (empty($attribute)) { continue; } + if (strpos($attribute, ':') === false) { + continue; + } [$name, $value] = explode(':', $attribute); $this->manifestData[strtolower($name)] = trim($value); } diff --git a/src/Kernel/Mnemonics/_ldc_w.php b/src/Kernel/Mnemonics/_ldc_w.php index ff8106b8..f7502989 100644 --- a/src/Kernel/Mnemonics/_ldc_w.php +++ b/src/Kernel/Mnemonics/_ldc_w.php @@ -44,7 +44,7 @@ public function execute(): void } elseif ($data instanceof Float_) { $value = \PHPJava\Kernel\Types\Float_::get($data->getBytes()); } else { - $value = $cpInfo[$data->getStringIndex()]; + $value = $cpInfo[$data->getClassIndex()]; } $this->pushToOperandStack($value); diff --git a/tests/Cases/Compiler/MagicConstantTest.php b/tests/Cases/Compiler/MagicConstantTest.php index 6082f190..8c9a5bab 100644 --- a/tests/Cases/Compiler/MagicConstantTest.php +++ b/tests/Cases/Compiler/MagicConstantTest.php @@ -42,7 +42,7 @@ public function testMagicConstDir() { [$output, $return] = $this->runJavaTest(__METHOD__); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '#php-java/tests/Cases/Compiler/Codes$#', $output[0] ); @@ -52,7 +52,7 @@ public function testMagicConstFile() { [$output, $return] = $this->runJavaTest(__METHOD__); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '#php-java/tests/Cases/Compiler/Codes/TestMagicConstFile.php$#', $output[0] );