phpdbg's opcode listing does not include the bodies of property hooks
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
Description
phpdbg's -p option prints the opcodes of the main script, its functions, and the methods of its classes. It does not print the opcodes of property hooks (PHP 8.4+), and they cannot be selected by name either.
The following code (hooks.php):
<?php declare(strict_types=1);
final class Temperature
{
public float $celsius = 0.0 {
set {
if ($value < -273.15) {
throw new ValueError('Below absolute zero');
}
$this->celsius = $value;
}
}
public float $fahrenheit {
get => $this->celsius * 9 / 5 + 32;
}
public function reset(): void
{
$this->celsius = 0.0;
}
}
Listed with:
phpdbg -qrr '-p*' hooks.php
Resulted in this output:
$_main:
; (lines=1, args=0, vars=0, tmps=0)
; /path/to/hooks.php:1-23
L0023 0000 RETURN int(1)
user class: Temperature
1 methods: reset
Temperature::reset:
; (lines=3, args=0, vars=0, tmps=1)
; /path/to/hooks.php:18-21
L0020 0000 ASSIGN_OBJ THIS string("celsius")
L0020 0001 OP_DATA float(0)
L0021 0002 RETURN null
But I expected this output instead: the opcodes of Temperature::$celsius::set and Temperature::$fahrenheit::get listed after those of Temperature::reset, for instance:
Temperature::$celsius::set:
; (lines=10, args=1, vars=1, tmps=4)
; /path/to/hooks.php:5-11
L0004 0000 CV0($value) = RECV 1
L0006 0001 T1 = IS_SMALLER CV0($value) float(-273.15)
L0006 0002 JMPZ T1 0007
L0007 0003 T2 = NEW 1 string("ValueError")
L0007 0004 SEND_VAL string("Below absolute zero") 1
L0007 0005 DO_FCALL
L0007 0006 THROW T2
L0010 0007 ASSIGN_OBJ THIS string("celsius")
L0010 0008 OP_DATA CV0($value)
L0011 0009 RETURN null
Temperature::$fahrenheit::get:
; (lines=8, args=0, vars=0, tmps=4)
; /path/to/hooks.php:15-15
L0015 0000 T0 = FETCH_OBJ_R THIS string("celsius")
...
(The opcodes above are taken from OPcache's dump of the same file on PHP 8.6 with opcache.opt_debug_level=0x40010000.)
The hooks are compiled: OPcache's debug dump of the same file (php -d opcache.enable_cli=1 -d opcache.opt_debug_level=0x10000 -r 'opcache_compile_file("hooks.php");') contains Temperature::$celsius::set: and Temperature::$fahrenheit::get: with their opcodes.
The hooks cannot be listed individually either:
$ phpdbg -qrr '-p=Temperature::$celsius::set' hooks.php
[The method Temperature::$celsius could not be found]
Cause
phpdbg_print_opcodes_ce() in sapi/phpdbg/phpdbg_print.c prints the methods in ce->function_table (and its header counts them: "1 methods: reset"). Property hooks are not stored in the function table but in zend_property_info->hooks (Zend/zend_compile.h), so they are skipped. The lookup for -p=Class::method (phpdbg_print_opcodes_method_ce()) also only searches ce->function_table.
zend_foreach_op_array() in Zend/Optimizer/zend_optimizer.c shows how to reach the hooks: it iterates ce->properties_info and visits hooks[i] for each property declared by the class (property->ce == ce), skipping hooks that are copied from traits (ZEND_ACC_TRAIT_CLONE). phpdbg_print_opcodes_ce() could do the same after printing the methods.
PHP Version
PHP 8.5.12 (cli) (built: Oct 19 2026 17:02:46) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine #NoAI
Zend Engine v4.5.12, Copyright (c) Zend Technologies
with Xdebug v3.5.3, Copyright (c) 2002-2026, by Derick Rethans
with Zend OPcache v8.5.12, Copyright (c), by Zend Technologies
Operating System
Fedora 45
- Linguagem predominante
- C
- Estrelas
- 41.8k
- Forks
- 8.5k
- Merge médio
- 2d 12h
- PRs com merge (30d)
- 137
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de php/php-src
-
SNMP accepts malformed remote portsTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 Meio dia Facilidade para iniciantes 62/100
php/php-src#25137 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Bug Status: Needs Triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
Mantenedores costumam responder em até 1 dia
-
quoted_printable_encode() produces lines longer than 76 characters for bytes 0xF5 to 0xFFTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
Bug Status: Needs Triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
php/php-src#24196 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Feature Status: Needs Triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 73/100
php/php-src#24183 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de php/php-src
Issues semelhantes
-
enhancement good first issue help wanted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
-
bug multiplayer status: planned
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
ChupathingyCE/chupathingyce#851 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 73/100
HigherOrderCO/Bend#2104 ·
-
research-radar
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
good first issue help wanted program
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
hffgzktbcc-blip/ounce-core#297 ·
Mantenedores costumam responder em até 1 dia