1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-24 15:32:36 +01:00
Files
archived-doc-es/reference/errorfunc/functions/debug-backtrace.xml
Pedro Antonio Gil Rodríguez 06246f0c99 Correcciones menores
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@342272 c90b9560-bf6c-de11-be94-00142212c4b1
2017-04-08 18:39:20 +00:00

282 lines
7.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 9fad144a4f011519dfe3f5a4b8c522083b7c4489 Maintainer: yago Status: ready -->
<refentry xml:id="function.debug-backtrace" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>debug_backtrace</refname>
<refpurpose>Genera un rastreo</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>DEBUG_BACKTRACE_PROVIDE_OBJECT</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>limit</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
<function>debug_backtrace</function> genera un rastreo de PHP.
</para>
</refsect1>
<refsect1 role="parameters"><!-- {{{ -->
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
Desde 5.3.6, este parámetro es una mascara de bits para las siguientes opciones:
<table>
<title><function>debug_backtrace</function> options</title>
<tgroup cols="2">
<tbody>
<row>
<entry>DEBUG_BACKTRACE_PROVIDE_OBJECT</entry>
<entry>
Completar el índice "object" o no.
</entry>
</row>
<row>
<entry>DEBUG_BACKTRACE_IGNORE_ARGS</entry>
<entry>
Omitir el índice "args" y por lo tanto todos los argumentos de las funciones/métodos para
ahorrar memoria o no.
</entry>
</row>
</tbody>
</tgroup>
</table>
Antes de 5.3.6, el único valor reconocido es &true; o &false;, que es lo mismo que
establecer y desestablecer la opción <constant>DEBUG_BACKTRACE_PROVIDE_OBJECT</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>limit</parameter></term>
<listitem>
<para>
Desde 5.4.0, este parámetro puede ser usado para limitar el número de stack frames que se muestran.
Por defecto (<parameter>limit</parameter>=<literal>0</literal>) imprime todos los stack frames.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1><!-- }}} -->
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Devuelve un array de <type>array</type> asociativos. Los posibles elementos devueltos
son los siguientes:
</para>
<para>
<table>
<title>Posibles elementos devueltos por <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>
El nombre de la función actual. Véase también
<link linkend="language.constants.predefined">__FUNCTION__</link>.
</entry>
</row>
<row>
<entry>line</entry>
<entry><type>integer</type></entry>
<entry>
El número de línea actual. Véase también
<link linkend="language.constants.predefined">__LINE__</link>.
</entry>
</row>
<row>
<entry>file</entry>
<entry><type>string</type></entry>
<entry>
El nombre de archivo actual. Véase también
<link linkend="language.constants.predefined">__FILE__</link>.
</entry>
</row>
<row>
<entry>class</entry>
<entry><type>string</type></entry>
<entry>
El nombre de la <link linkend="language.oop5">clase</link> actual. Véase también
<link linkend="language.constants.predefined">__CLASS__</link>
</entry>
</row>
<row>
<entry>object</entry>
<entry><type>object</type></entry>
<entry>
El <link linkend="language.oop5">objeto</link> actual.
</entry>
</row>
<row>
<entry>type</entry>
<entry><type>string</type></entry>
<entry>
El tipo de llamada actual. Si es una llamada a un método devuelve "->". Si es una llamada
a un método estático devuelve "::". Si es una llamada a una función no se devuelve nada.
</entry>
</row>
<row>
<entry>args</entry>
<entry><type>array</type></entry>
<entry>
Dentro de una función se lista los argumentos de la función.
Dentro de un archvo incluido se lista el nombre (o nombres) del archivo incluido.
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>5.4.0</entry>
<entry>
Añadido el parámetro opcional <parameter>limit</parameter>.
</entry>
</row>
<row>
<entry>5.3.6</entry>
<entry>
Se cambió el parámetro <parameter>provide_object</parameter> a <parameter>options</parameter> y se añadió la
opción adicional <constant>DEBUG_BACKTRACE_IGNORE_ARGS</constant>.
</entry>
</row>
<row>
<entry>5.2.5</entry>
<entry>
Se añadió el parámetro opcional <parameter>provide_object</parameter>.
</entry>
</row>
<row>
<entry>5.1.1</entry>
<entry>
Se añadió el <type>object</type> actual como posible elemento devuelto.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Ejemplo de <function>debug_backtrace</function></title>
<programlisting role="php">
<![CDATA[
<?php
// nombre de archivo: /tmp/a.php
function una_prueba($str)
{
echo "\nHola: $str";
var_dump(debug_backtrace());
}
una_prueba('amigo');
?>
<?php
// nombre de archivo: /tmp/b.php
include_once '/tmp/a.php';
?>
]]>
</programlisting>
<para>
El resultado es similar al siguiente cuando se ejecuta
<filename>/tmp/b.php</filename>:
</para>
<screen>
<![CDATA[
Hola: amigo
array(2) {
[0]=>
array(4) {
["file"] => string(10) "/tmp/a.php"
["line"] => int(10)
["function"] => string(10) "una_prueba"
["args"]=>
array(1) {
[0] => &string(5) "amigo"
}
}
[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
-->