1
0
mirror of https://github.com/php/doc-it.git synced 2026-03-25 08:02:09 +01:00
Files
archived-doc-it/reference/errorfunc/functions/debug-backtrace.xml

285 lines
8.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: e203b12d7964aa7c729e1f7c26fcbf357fc9fb63 Maintainer: ManueldG Status: ready -->
<!-- Reviewed: no -->
<!-- CREDITS: cucinato -->
<refentry xml:id="function.debug-backtrace" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>debug_backtrace</refname>
<refpurpose>Genera un backtrace</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>debug_backtrace</methodname>
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer><constant>DEBUG_BACKTRACE_PROVIDE_OBJECT</constant></initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>limit</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
<function>debug_backtrace</function> genera un backtrace di PHP.
</para>
</refsect1>
<refsect1 role="parameters"><!-- {{{ -->
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
Questo parametro è una bitmask per le seguenti opzioni:
<table>
<title>Opzioni di <function>debug_backtrace</function></title>
<tgroup cols="2">
<tbody>
<row>
<entry>DEBUG_BACKTRACE_PROVIDE_OBJECT</entry>
<entry>
Indica se popolare o meno l'"oggetto" index.
</entry>
</row>
<row>
<entry>DEBUG_BACKTRACE_IGNORE_ARGS</entry>
<entry>
Indica se omettere o meno gli indici di "args" e quindi tutti gli argomenti della funzione/metodo,
per risparmiare memoria.
</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>
Ci sono quattro possibili combinazioni:
<table>
<title>Opzioni di <function>debug_backtrace</function></title>
<tgroup cols="2">
<tbody>
<row>
<entry><code>debug_backtrace()</code></entry>
<entry morerows="2" valign="middle">
Popola entrambi gli indici
</entry>
</row>
<row>
<entry><code>debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT)</code></entry>
</row>
<row>
<entry><code>debug_backtrace(1)</code></entry>
</row>
<row>
<entry><code>debug_backtrace(0)</code></entry>
<entry valign="middle">
Omette l'indice di <literal>"object"</literal> e popola l'indice di <literal>"args"</literal>.
</entry>
</row>
<row>
<entry><code>debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)</code></entry>
<entry morerows="1" valign="middle">
Omette l'indice <literal>"object"</literal> <emphasis> e </emphasis> l'indice di <literal>"args"</literal>.
</entry>
</row>
<row>
<entry><code>debug_backtrace(2)</code></entry>
</row>
<row>
<entry><code>debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS)</code></entry>
<entry morerows="1" valign="middle">
Popola l'indice <literal>"object"</literal> <emphasis> e </emphasis> omette l'indice <literal>"args"</literal>.
</entry>
</row>
<row>
<entry><code>debug_backtrace(3)</code></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</note>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>limit</parameter></term>
<listitem>
<para>
Questo parametro può essere utilizzato per limitare il numero di stack frame restituiti.
Per default (<parameter>limit</parameter>=<literal>0</literal>) restituisce tutti gli stack frame.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1><!-- }}} -->
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Restituisce un array associativo <type>array</type>. Gli elementi che possono essere restituiti
sono elencati nella seguente tabella:
</para>
<para>
<table>
<title>Elementi restituibili dalla funzione <function>debug_backtrace</function></title>
<tgroup cols="3">
<thead>
<row>
<entry>&Name;</entry>
<entry>&Type;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>function</entry>
<entry><type>string</type></entry>
<entry>
Il nome della funzione corrente. Vedere anche
<link linkend="language.constants.predefined">__FUNCTION__</link>.
</entry>
</row>
<row>
<entry>line</entry>
<entry><type>int</type></entry>
<entry>
Il numero della linea corrente. Vedere anche
<link linkend="language.constants.predefined">__LINE__</link>.
</entry>
</row>
<row>
<entry>file</entry>
<entry><type>string</type></entry>
<entry>
Il nome del file corrente. Vedere anche
<link linkend="language.constants.predefined">__FILE__</link>.
</entry>
</row>
<row>
<entry>class</entry>
<entry><type>string</type></entry>
<entry>
Il nome della <link linkend="language.oop5">classe</link> corrente. Vedere anche
<link linkend="language.constants.predefined">__CLASS__</link>
</entry>
</row>
<row>
<entry>object</entry>
<entry><type>object</type></entry>
<entry>
L'<link linkend="language.oop5">object</link> corrente.
</entry>
</row>
<row>
<entry>type</entry>
<entry><type>string</type></entry>
<entry>
Il tipo di chiamata corrente. Se è una chiamata ad un metodo, viene restituito "-&gt;".
Se è una chiamata ad un metodo statico, viene restituito "::". Se è una chiamata ad una funzione, non viene restituito nulla.
</entry>
</row>
<row>
<entry>args</entry>
<entry><type>array</type></entry>
<entry>
Se dentro una funzione, elenca una lista con gli argomenti della funzione.
Se all'interno di un file che è stato incluso, elenca i nomi dei file inclusi.
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Esempio di <function>debug_backtrace</function></title>
<programlisting role="php">
<![CDATA[
<?php
// filename: /tmp/a.php
function a_test($str)
{
echo "\nHi: $str";
var_dump(debug_backtrace());
}
a_test('friend');
?>
<?php
// filename: /tmp/b.php
include_once '/tmp/a.php';
?>
]]>
</programlisting>
<para>
Fornisce risultati simili al seguente esempio quando si esegue
<filename>/tmp/b.php</filename>:
</para>
<screen>
<![CDATA[
Hi: friend
array(2) {
[0]=>
array(4) {
["file"] => string(10) "/tmp/a.php"
["line"] => int(10)
["function"] => string(6) "a_test"
["args"]=>
array(1) {
[0] => &string(6) "friend"
}
}
[1]=>
array(4) {
["file"] => string(10) "/tmp/b.php"
["line"] => int(2)
["args"] =>
array(1) {
[0] => string(10) "/tmp/a.php"
}
["function"] => string(12) "include_once"
}
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>trigger_error</function></member>
<member><function>debug_print_backtrace</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->