<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: Uso de @</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Gracias a todos por sus respuestas, me quedó más que claro el asunto.</FONT>
</P>
<BR>

<P><FONT SIZE=2>Saludos cordiales,</FONT>
<BR><FONT SIZE=2>Esteban Osorio.</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>-----Mensaje original-----</FONT>
<BR><FONT SIZE=2>De: Ricardo Mun~oz A. [<A HREF="mailto:rmunoz@pjud.cl">mailto:rmunoz@pjud.cl</A>] </FONT>
<BR><FONT SIZE=2>Enviado el: Miércoles, 04 de Octubre de 2006 9:25</FONT>
<BR><FONT SIZE=2>Para: Lista de desarrolladores en PHP</FONT>
<BR><FONT SIZE=2>Asunto: Re: Uso de @</FONT>
</P>

<P><FONT SIZE=2>Rodrigo Fuentealba wrote:</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp; On 10/3/06, Esteban Osorio &lt;eosorio@economia.cl&gt; wrote:</FONT>
<BR><FONT SIZE=2>&gt;&gt; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; &gt; Hola lista,</FONT>
<BR><FONT SIZE=2>&gt;&gt; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; &gt; Alguien me podría explicar para que se utiliza el símbolo @ antes de</FONT>
<BR><FONT SIZE=2>&gt;&gt; algunas funciones como por ejemplo en este código:</FONT>
<BR><FONT SIZE=2>&gt;&gt; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; &gt; $result =</FONT>
<BR><FONT SIZE=2>&gt;&gt; @move_uploaded_file($_FILES['image_file']['tmp_name'],</FONT>
<BR><FONT SIZE=2>&gt;&gt; $newimage);</FONT>
<BR><FONT SIZE=2>&gt;&gt; &gt; if(empty($result))</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; La @ es para ejecutar una sentencia/instrucción sin reportar errores,</FONT>
<BR><FONT SIZE=2>&gt; es una MUY MALA práctica, puesto que podría hacerte perder un par de</FONT>
<BR><FONT SIZE=2>&gt; horas depurando. Presenta el mismo efecto que </FONT>
<BR><FONT SIZE=2>&gt; ini_set('display_errors','off');</FONT>
</P>

<P><FONT SIZE=2>segun el comentario de display_errors en php.ini:</FONT>
</P>

<P><FONT SIZE=2>; Print out errors (as a part of the output).&nbsp; For production web sites,</FONT>
<BR><FONT SIZE=2>; you're strongly encouraged to turn this feature off, and use error logging</FONT>
<BR><FONT SIZE=2>; instead (see below).&nbsp; Keeping display_errors enabled on a production </FONT>
<BR><FONT SIZE=2>web site</FONT>
<BR><FONT SIZE=2>; may reveal security information to end users, such as file paths on </FONT>
<BR><FONT SIZE=2>your Web</FONT>
<BR><FONT SIZE=2>; server, your database schema or other information.</FONT>
<BR><FONT SIZE=2>display_errors = Off</FONT>
</P>

<P><FONT SIZE=2>es decir, para sitios en produccion se recomienda deshabilitar cualquier</FONT>
<BR><FONT SIZE=2>mensaje de error que aparezca en la pagina. lo que se debe usar es lo</FONT>
<BR><FONT SIZE=2>siguiente:</FONT>
</P>

<P><FONT SIZE=2>; Log errors into a log file (server-specific log, stderr, or error_log </FONT>
<BR><FONT SIZE=2>(below))</FONT>
<BR><FONT SIZE=2>; As stated above, you're strongly advised to use error logging in place of</FONT>
<BR><FONT SIZE=2>; error displaying on production web sites.</FONT>
<BR><FONT SIZE=2>log_errors = On</FONT>
</P>

<P><FONT SIZE=2>activando log_errors los mensajes de error quedan registrados en un archivo</FONT>
<BR><FONT SIZE=2>de log, en el caso de Linux en el mismo archivo de errores del Apache, para</FONT>
<BR><FONT SIZE=2>asi poder revisar los errores sin que le aparezcan al usuario...</FONT>
</P>

<P><FONT SIZE=2>para sitios en desarrollo es casi una obligacion usar display_errors = </FONT>
<BR><FONT SIZE=2>On... ;)</FONT>
</P>

<P><FONT SIZE=2>&gt; Lo ideal es que no lo uses y que</FONT>
<BR><FONT SIZE=2>&gt; valides si existe un error dentro de tu código para presentar las</FONT>
<BR><FONT SIZE=2>&gt; acciones pertinentes vía un die(); o un echo('&lt;h1&gt;ERROR</FONT>
<BR><FONT SIZE=2>&gt; AQUI!!!&lt;/h1&gt;'); (por poner ejemplos)</FONT>
</P>

<P><FONT SIZE=2>puede seguir usando la @ pero igualmente detectar/reportar el error:</FONT>
</P>

<P><FONT SIZE=2>$result = @move_uploaded_file($_FILES['image_file']['tmp_name'], </FONT>
<BR><FONT SIZE=2>$newimage);</FONT>
</P>

<P><FONT SIZE=2>if($result == false)</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; mail(&quot;admin@dominio&quot;,&quot;error en pagina&quot;,&quot;blablabla&quot;);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; die(&quot;Ocurrio un error...&quot;);</FONT>
<BR><FONT SIZE=2>}</FONT>
<BR><FONT SIZE=2>else</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; // codigo</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2>aunque la @ de mas arriba estaria demas en un sitio en produccion ya que</FONT>
<BR><FONT SIZE=2>estarian desactivados todos los mensajes de error con display_errors = Off.</FONT>
</P>

<P><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Ricardo Mun~oz A.</FONT>
<BR><FONT SIZE=2>Usuario Linux #182825 (counter.li.org)</FONT>
</P>

</BODY>
</HTML>