Running Zend/zend_vm_gen.php on 32-bit system produces deprecation warnings
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The following code:
./buildconf
./configure --disable-all
make
Emits some warnings when executing the Zend/zend_vm_gen.php script during the build (this is output for PHP 8.4, but also 8.3 and 8.2 produces similar warnings):
Deprecated: Implicit conversion from float 2147483648 to int loses precision in /home/petk/projects/php-src/Zend/zend_vm_gen.php on line 2476
Deprecated: Implicit conversion from float 2147483648 to int loses precision in /home/petk/projects/php-src/Zend/zend_vm_gen.php on line 2537
...
This removes the warnings, but as this script is 3k lines long all-in-one PHP file, I think it's better someone looks at this if this is correct.
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index 7f503e78e2..473a774734 100755
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -2473,7 +2473,7 @@ function gen_vm($def, $skel) {
$opcodes[$code]["flags"] |= $vm_op_flags["ZEND_VM_NO_CONST_CONST"];
}
if (isset($opcodes[$code]["spec"]["COMMUTATIVE"])) {
- $opcodes[$code]["flags"] |= $vm_op_flags["ZEND_VM_COMMUTATIVE"];
+ $opcodes[$code]["flags"] |= (int) $vm_op_flags["ZEND_VM_COMMUTATIVE"];
}
}
$opnames[$op] = $code;
@@ -2534,7 +2534,7 @@ function gen_vm($def, $skel) {
$opcodes[$code]["flags"] |= $vm_op_flags["ZEND_VM_NO_CONST_CONST"];
}
if (isset($opcodes[$code]["spec"]["COMMUTATIVE"])) {
- $opcodes[$code]["flags"] |= $vm_op_flags["ZEND_VM_COMMUTATIVE"];
+ $opcodes[$code]["flags"] |= (int)$vm_op_flags["ZEND_VM_COMMUTATIVE"];
}
}
$opnames[$op] = $code;
PHP Version
PHP 8.2
Operating System
32-bit *nix (for example Debian or FreeBSD)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the warning with ./buildconf, ./configure --disable-all, and make on a 32-bit system. Inspect Zend/zend_vm_gen.php around lines 2476 and 2537, then verify that VM generation completes without deprecation warnings and that the generated build remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100