Bug #17173 Updated: "case" causes AV

From: Date: Thu, 30 May 2002 23:40:09 +0000
Subject: Bug #17173 Updated: "case" causes AV
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-8966@lists.php.net to get a copy of this message
 ID:               17173
 Updated by:       phanto@php.net
 Reported By:      mbretter@inode.at
 Status:           Feedback
 Bug Type:         COM related
 Operating System: Windows 2000 SP2
 PHP Version:      4.1.2
 New Comment:

please can you verify this with a recent cvs snapshot


Previous Comments:
------------------------------------------------------------------------

[2002-05-30 08:55:44] phanto@php.net

what is the correspondent value and datatype in the db that causes the
crash ?
checking for empty will always result in TRUE because 'value' is not an
actual property but only an overloaded action that calls com_propget()
so empty() doesn't see it as property (i assume strftime() never gets
called in your script).

------------------------------------------------------------------------

[2002-05-13 09:44:31] mbretter@jawa.at

The AV still exists, 
I tried the latest Snapshot from snaps.php.net

------------------------------------------------------------------------

[2002-05-13 04:38:32] mfischer@php.net

There have been a few changes to the COM extension since the 4.1.2
release. Please try a new version or even a snapshot from
http://bugs.php.net/?id=17173&edit=1

------------------------------------------------------------------------

[2002-05-13 03:51:06] mbretter@inode.at

This script let php crash.
The Problem is the case-statement in the convert_field_crash-function,
but with an If-statement this crash doesen't occur.

<?php

define('adDBTimeStamp', 135);

$conn = new COM( "ADODB.Connection" );

$rs = new COM( "ADODB.Recordset" );
$conn->Provider = 'SQLOLEDB';
$conn->Open( "Server=wincubix;Uid=oebb;Pwd=oebb;Database=cubix" );
@$rs->Open( "SELECT * FROM news ", $conn);

echo '<table>';
while (!$rs->EOF) {
	echo '<tr>';
    for ($i=0; $i < $rs->Fields->Count(); $i++) {
   		echo '<td>';
		echo convert_field_crash($rs->Fields[$i]);
   		echo '</td>';
    }
	echo '</tr>';
    $rs->MoveNext();
}
echo '</table>';

$rs->Close;
$conn->Close;

$rs->Release();
$rs = null;

$conn->Release();
$conn = null;

function convert_field($field) {
	if ($field->type == adDBTimeStamp) {
		if (empty($field->Value)) return '';
		return strftime('%Y-%m-%d %T', $field->value);
	} else {
		return $field->Value;
	}
}

function convert_field_crash($field) {
	// case verursacht AV
	switch($field->type) {
		case adDBTimeStamp:
			return strftime('%Y-%m-%d %T', $field->value);
			break;
		default:
			return $field->Value;
	}
}

?>

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17173&edit=1



Thread (17 messages)

« previous php.bugs (#8966) next »