mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 16:32:13 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@177739 c90b9560-bf6c-de11-be94-00142212c4b1
180 lines
5.9 KiB
XML
180 lines
5.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- splitted from ./es/functions/errorfunc.xml, last change in rev 1.1 -->
|
|
<!-- last change to 'error-reporting' in en/ tree in rev 1.1 -->
|
|
<refentry id="function.error-reporting">
|
|
<refnamediv>
|
|
<refname>error_reporting</refname>
|
|
<refpurpose>Establece que errores de PHP son informados</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descripción</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>error_reporting</methodname>
|
|
<methodparam choice="opt"><type>int</type><parameter>level</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
La función <function>error_reporting</function> permite establecer la directiva
|
|
<link linkend="ini.error-reporting">error_reporting</link> en tiempo de ejecución. PHP tiene numerosos niveles de errores, que se pueden seleccionar de manera temporal (mientras dure la ejecución del script) mediante esta función.
|
|
</para>
|
|
<para>
|
|
<function>error_reporting</function> establece el nivel de errores que notifica PHP y devuelve el nivel anterior. El parámetro <parameter>level</parameter> se puede establecer mediante una máscara de bits o mediante algunas constantes específicas. Se recomienda utilizar las constantes para asegurar la compatibilidad con versiones futuras. La causa de esta posible incompatibilidad es que a medida que se crean nuevos niveles de errores, aumenta el rango de números utilizado para indicarlo, por lo que podrían dejar de funcionar los anteriores niveles de errores indicados numéricamente.
|
|
</para>
|
|
<para>
|
|
<example role="php">
|
|
<title>Ejemplos de <function>error_reporting</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// Deshabilita la notificación de errores
|
|
error_reporting(0);
|
|
|
|
// Notifica errores simples de ejecución
|
|
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
|
|
|
// Utilizar E_NOTICE puede ser útil también (para notificar sobre
|
|
// variables no inicializadas y otros errores de escritura ...)
|
|
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
|
|
|
|
// Notifica todos los errores salvo E_NOTICE
|
|
// Este nivel es el valor por defecto establecido en el archivo php.ini
|
|
error_reporting(E_ALL ^ E_NOTICE);
|
|
|
|
// Notifica todos los errores de PHP (en PHP 3 se puede utilizar la máscara 63)
|
|
error_reporting(E_ALL);
|
|
|
|
// Lo siguiente es equivalente a error_reporting(E_ALL);
|
|
ini_set('error_reporting', E_ALL);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Los niveles de error disponibles se muestran a continuación. La explicación de
|
|
cada uno de los niveles de error se encuentra en la sección <link linkend="errorfunc.constants"></link>.
|
|
<table>
|
|
<title>Constantes y máscaras de bits de los niveles de <function>error_reporting</function></title>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>valor</entry>
|
|
<entry>constante</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry>
|
|
<link linkend="e-error">E_ERROR</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry>
|
|
<link linkend="e-warning">E_WARNING</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry>
|
|
<link linkend="e-parse">E_PARSE</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>8</entry>
|
|
<entry>
|
|
<link linkend="e-notice">E_NOTICE</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>16</entry>
|
|
<entry>
|
|
<link linkend="e-core-error">E_CORE_ERROR</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>32</entry>
|
|
<entry>
|
|
<link linkend="e-core-warning">E_CORE_WARNING</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>64</entry>
|
|
<entry>
|
|
<link linkend="e-compile-error">E_COMPILE_ERROR</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>128</entry>
|
|
<entry>
|
|
<link linkend="e-compile-warning">E_COMPILE_WARNING</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>256</entry>
|
|
<entry>
|
|
<link linkend="e-user-error">E_USER_ERROR</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>512</entry>
|
|
<entry>
|
|
<link linkend="e-user-warning">E_USER_WARNING</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1024</entry>
|
|
<entry>
|
|
<link linkend="e-user-error">E_USER_NOTICE</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2047</entry>
|
|
<entry>
|
|
<link linkend="e-all">E_ALL</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2048</entry>
|
|
<entry>
|
|
<link linkend="e-strict">E_STRICT</link>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<warning>
|
|
<simpara>
|
|
Las versiones de PHP > 5.0.0 también incluyen el nivel <constant>E_STRICT</constant> (valor 2048). <constant>E_ALL</constant> <emphasis>NO</emphasis> incluye el nivel <constant>E_STRICT</constant>.
|
|
</simpara>
|
|
</warning>
|
|
<para>
|
|
Puede consultar también la directiva <link linkend="ini.display-errors">display_errors</link> y la función <function>ini_set</function>.
|
|
</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:"../../../../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
|
|
-->
|