Skip to content

Document DEBUG_BACKTRACE_PROVIDE_OBJECT as inert for debug_print_backtrace() - #5217

Merged
lacatoire merged 1 commit into
php:masterfrom
lacatoire:debug_print_backtrace_document
Aug 21, 2026
Merged

lacatoire merged 1 commit into
php:masterfrom
lacatoire:debug_print_backtrace_document

Conversation

@lacatoire

@lacatoire lacatoire commented Jan 29, 2026 •

Copy link
Copy Markdown
Member

debug_print_backtrace() accepts the same $options as debug_backtrace(), but the manual only documents DEBUG_BACKTRACE_IGNORE_ARGS. The linked issue asks whether DEBUG_BACKTRACE_PROVIDE_OBJECT does anything at all.

It does not. Measured on PHP 8.5.4, with an object method in the stack:

--- no option (default 0) ---
#0 t.php(5): A->go()
#1 t.php(6): wrap('...')
--- DEBUG_BACKTRACE_PROVIDE_OBJECT ---
#0 t.php(5): A->go()
#1 t.php(6): wrap('...')          identical
--- DEBUG_BACKTRACE_IGNORE_ARGS ---
#0 t.php(5): A->go()
#1 t.php(6): wrap()               differs

ZEND_FUNCTION(debug_print_backtrace) in Zend/zend_builtin_functions.c builds the backtrace array, renders it with zend_trace_to_string(), writes the string and frees the array. The option does populate the object key of that array, but the rendering never reads it and the array is discarded, so nothing is observable. Consistently with that, debug_print_backtrace() defaults to 0, while debug_backtrace() defaults to DEBUG_BACKTRACE_PROVIDE_OBJECT.

The row therefore documents the option as accepted and inert, rather than describing an effect a reader cannot observe. Whether passing it should be deprecated is a php-src question and is not addressed here.

Fixes: #4734

@lacatoire lacatoire closed this Mar 2, 2026
@lacatoire lacatoire reopened this Aug 21, 2026
@lacatoire
lacatoire force-pushed the debug_print_backtrace_document branch from e9b46ef to 147506b Compare August 21, 2026 09:59
@lacatoire
lacatoire force-pushed the debug_print_backtrace_document branch from 147506b to d7ce0c2 Compare August 21, 2026 14:21
@lacatoire lacatoire changed the title Document DEBUG_BACKTRACE_PROVIDE_OBJECT for debug_print_backtrace() Document DEBUG_BACKTRACE_PROVIDE_OBJECT as inert for debug_print_backtrace() Aug 21, 2026
@lacatoire
lacatoire merged commit 41911b4 into php:master Aug 21, 2026
2 checks passed
@lacatoire
lacatoire deleted the debug_print_backtrace_document branch September 10, 2026 14:02
KentarouTakeda added a commit to php/doc-ja that referenced this pull request Oct 4, 2026
* errorfunc を原文の変更に追従 (2ファイル)

errorfunc の 2 ファイルを原文の変更に追従しました。これで errorfunc モジュールの未訳・要更新はなくなります。

原文では次の変更がありました。

- `error_get_last()` の戻り値に、PHP 8.5.0 以降は `fatal_error_backtraces` が有効なとき、致命的なエラーのバックトレースを持つ `"trace"` キーが含まれることが追記されました(php/doc-en@cd40b08、php/doc-en#5883)
- `debug_print_backtrace()` の `options` に、`debug_backtrace()` との互換性のために指定できるが効果のない `DEBUG_BACKTRACE_PROVIDE_OBJECT` が追記されました(php/doc-en@41911b4、php/doc-en#5217)

## 対象ファイル

reference/errorfunc/ (2) — functions/debug-print-backtrace.xml, functions/error-get-last.xml

* debug_print_backtrace() の DEBUG_BACKTRACE_IGNORE_ARGS の説明の誤りを修正

「メモリを節約する」を逆の意味に訳していた誤りを修正しました。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

debug_print_backtrace does not mention option DEBUG_BACKTRACE_PROVIDE_OBJECT

1 participant