|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-05-13 03:51 UTC] mbretter at jawa dot 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;
}
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 04:00:01 2025 UTC |
reclassify: switch($obj->prop) {..} does not work on overloaded objects, a NULL zval is passed as the property_reference parameter to the get_property handler. here is a short sample script: $field = new variant("huh"); convert_field($field); function convert_field($field) { $tmp = $field->type; switch($tmp) { case 123: break; default: return $field->value; } } function convert_field_crash($field) { switch($field->type) { case 123: break; default: return $field->value; } }Same here. I'm using 4.3.1 on the server and on my dev machine. It hangs on the server when calling $conn = new COM("ADODB.Connection"); On my dev machine it works. Only difference is, that is have ADO 2.5 on my dev machine and ADO 2.7 on the server. So the new 2.7 seems to cause problems.