#29180 [Opn]: Client crash

From: Date: Thu, 15 Jul 2004 22:59:05 +0000
Subject: #29180 [Opn]: Client crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-62417@lists.php.net to get a copy of this message
ID: 29180 Updated by: tularis@php.net Reported By: tila at home dot nl Status: Open Bug Type: PostgreSQL related Operating System: Linux 2.4.24 PHP Version: 5.0.0 New Comment: does it also crash when NOT using the PEAR::DB class? Previous Comments: ------------------------------------------------------------------------ [2004-07-16 00:40:32] tila at home dot nl new code, I am sorry. I cannot provide a link to the server. open it with ?id=5 as parameter. <?php require_once ('DB.php'); $dsn = "pgsql://apache:apache@localhost/groupware"; $db = DB::connect($dsn, true); $QUERY = "SELECT o.* FROM personoverview o"; $result = $db->query($QUERY); $total = $result->numRows(); $offset = $_GET['id']?$_GET['id']:0; $perpage = 10; for ($i = $offset; (($i < $total) && ($i < ($offset + $perpage))); $i++) { $row = $result->fetchRow(DB_FETCHMODE_ASSOC, $i); } echo $offset; ?> ------------------------------------------------------------------------ [2004-07-15 11:50:43] derick@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2004-07-15 11:03:20] tila at home dot nl Description: ------------ The client crash on the following code when offset > 0; I don't get an error message. Reproduce code: --------------- $result = $db->query($QUERY); $total = $result->numRows(); $back = max (0, $offset - $perpage); $forward = min (($offset + $perpage), max (0, (($perpage * ceil ($total / $perpage)) - $perpage))); $end = max (0, (($perpage * ceil ($total / $perpage)) - $perpage)); $overviewtemplate->setVariable("back", $back); $overviewtemplate->setVariable("forward", $forward); $overviewtemplate->setVariable("end", $end); for ($i = $offset; (($i < $total) && ($i < ($offset + $perpage))); $i++) { $row = $result->fetchRow(DB_FETCHMODE_ASSOC, $i); while (list($key, $value) = each($row)) { $row[$key] = stripslashes(trim($row[$key])); } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29180&edit=1

« previous php.bugs (#62417) next »