php / php/php-src

Running Zend/zend_vm_gen.php on 32-bit system produces deprecation warnings

Aperta
#15,899 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Bug Status: Needs Triage
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

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)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci l’avviso con ./buildconf, ./configure --disable-all e make su un sistema a 32 bit. Ispeziona Zend/zend_vm_gen.php intorno alle righe 2476 e 2537, quindi verifica che la generazione della VM venga completata senza avvisi di deprecazione e che il build generato rimanga valido.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
php
Ambito
build-system, compilers
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.