note 54477 added to function.apd-croak

From: Date: Tue, 05 Jul 2005 19:18:09 +0000
Subject: note 54477 added to function.apd-croak
Groups: php.notes 
Request: Send a blank email to php-notes+get-91486@lists.php.net to get a copy of this message
// A function that "ASSERTS", ie that dies if the boolean in parameter is false // ex: verify( $myDatabase->Connect() ); function verify( $bResult ) { if (!bResult) { echo "<hr><h1>ERROR</h1><hr>"; echo "<pre>Last call arguments:\n"; for($i=0;$i<func_num_args();$i++) { echo "&rarr;"; print_r( func_get_arg ($i) ); echo "&larr;\n"; } if (sizeof($_GET)) { echo "<hr>GET VARS\n"; print_r( $_GET ); } if (sizeof($_POST)) { echo "<hr>POST VARS\n"; print_r( $_POST ); } if (sizeof($_SERVER)) { echo "<hr>SERVER VARS\n"; print_r( $_SERVER ); } if (sizeof($_COOKIE )) { echo "<hr>COOKIE VARS\n"; print_r( $_COOKIE ); } // Disable if not on a protected server if (sizeof($_SESSION )) { echo "<hr>SESSION VARS\n"; print_r( $_SESSION ); } echo "</pre>"; echo "<hr>"; if (function_exists("apd_callstack")) { apd_croak("Error !"); } else { die(1); } } } ---- Manual Page -- http://www.php.net/manual/en/function.apd-croak.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54477 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54477&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54477&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54477&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54477&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54477&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54477&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54477&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#91486) next »