Internet download manager

Don't use die() to debug PDF Print E-mail
  
Tuesday, 15 April 2008 03:14

Don't use die() to debug

Joomla! 1.5 includes the ability to optionally store the user session in the database. In PHP 5, because of the order in which it does things, an connection to the database will be closed before it fires the session handlers.

As a result of this, the common-place practice of using the die(’test1’); function will result in a plethora of errors being thrown, similar to the following:

Warning: mysqli_query() [<a href=’function.mysqli-query’>function.mysqli-query</a>]: Couldn’t fetch mysqli in C:\Apache2\htdocs\www_site\libraries\joomla\database\database\mysqli.php on line 147

or:

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user ‘root’@’localhost’ (using password: NO) in /var/www/html/libraries/joomla/database/database/mysql.php on line 105

In order to stop execution gracefully, you need to use the following code:

Correct way to gracefully stop execution

echo 'Test';
$mainframe->close();

If you are developing your own component, you might like to include your own utility function to provide this functionality:

Function to stop execution with a message

function stop($msg = '')
{
global $mainframe;
echo $msg;
$mainframe->close();
}
 http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,tips:dontusedie/

 

 

Autos Motor

Univision.com: Autos
Autos nuevos y usados, fotos, videos y precios incluyendo el Kelley Blue Book de todos los Modelos 2008 como: BMW, Mercedes Benz, Jaguar, Ford, Chevrolet, Mazda, Volkswagen, Nissan, Toyota y muchas marcas mas.
Univision.com: Autos
  • ¿Sabes hacer un test drive?

    photo Si ya decidiste comprar o hacer un lease de un auto nuevo en el 2009, asegúrate de tener toda la información antes de firmar.


  • Ford Shelby GT 500 2010

    photoEl Ford Shelby GT500 2010 llega con más potencia y funcionalidad, acompañadas de un diseño mucho más musculoso y distintivo.


  • ¿Cómo se construyó el Evora?

    photoEl Lotus Evora 2010 necesitó de diversas pruebas de diseño para brindarle la imagen moderna y dinámica que posee.


  • Bentley Continental GTC Speed

    photo El Bentley GTC Speed 2009 es un convertible de 600 caballos de fuerza con un diseño que es la máxima expresión de elegancia.


  • El 2008 fue un abismo de ventas

    photoLas ventas de autos nuevos en Estados Unidos se derrumbaron a su nivel más bajo en décadas durante 2008.


Copyright © 2009 Internet download manager. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.