ID:               17173
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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

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

[2002-05-13 04:38:32] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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

Reply via email to