php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4887 memory corruption
Submitted: 2000-06-08 10:22 UTC Modified: 2000-08-18 13:26 UTC
From: websupport at silyn-tek dot de Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.0.0 Release OS: linux 2.2.14
Private report: No CVE-ID: None
 [2000-06-08 10:22 UTC] websupport at silyn-tek dot de
sorry for creating new bugthread, lost my userid, but please try this out

<?php
## here is a complete listing
## please create a database emerald
## go to an empty directory and start with
# rm *;while true ; do wget http://ts/test/test.php;done
## after getting about 1000 files do
# for i in *; do echo -n "$i:";diff -a test.php $i;
## why do so many files differ  and contain binary data ?????
 
function print_array($a)
{ while (list ($key, $val) = each ($a)) { echo "$key\t$val\n"; };};
function create_table()
{
        $r=mssql_query("drop table bugs");
        $r=mssql_query("drop table bugsb");
        $r=mssql_query("create table bugs (FIRSTNAME char(20),LASTNAME char(20),COMPANY char(20), COMMENTS char(20), CUSTOMERID integer)");
        $r=mssql_query("insert bugs values ('rainer','zufall','dusty','hallo',35800)");
        $r=mssql_query("create table bugsb (MAIDENNAME char(20),ACCOUNTTYPE char(20), CUSTOMERID integer)");
        $r=mssql_query("insert bugsb values ('geheim','surf20',35800)");
 
};
function fetch_cid($cid)
{
        $fields="FIRSTNAME,LASTNAME,COMPANY,COMMENTS";
        $res=array("a"=>"b");
        $r=mssql_query("select $fields from bugs where CUSTOMERID=$cid");
        if($r>0)
        {
                $ma=mssql_fetch_array($r);
                mssql_free_result($r);
                $res["FIRSTNAME"]=$ma["FIRSTNAME"];
                $res["LASTNAME"]=$ma["LASTNAME"];
                $res["COMPANY"]=$ma["COMPANY"];
                $res["COMMENTS"]=$ma["COMMENTS"];
        };
        $res["VAT"]=0;
        $r=mssql_query("select * from bugsb where CUSTOMERID=$cid");
        if($r>0)
        { $sa=mssql_fetch_array($r);
          mssql_free_result($r); };
        $com=$res["COMMENTS"];
        if(preg_match("/^(.*?):/",$com,$parts))
        { echo "i never get here, but thats ok"; };
        $testres["MAIDENNAME"]=$sa["MAIDENNAME"];
        $x=$sa["MAIDENNAME"];
        $x="geheim";
        $res["MAIDENNAME"]=$x;
        $res["EMAIL"]="email";
        $y=$sa["ACCOUNTTYPE"];
        $res["TARIF"]=$y;
        print_array($res);
        return $res;
};
$dbi=mssql_connect ("mssql","silyndb","nosilyndb");
create_table();
$u=fetch_cid(35800);
echo "\n";
print_array($u);
mssql_close($dbi);
?>                     

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-26 07:40 UTC] zak@php.net
I do not believe that this is a MSSQL bug...
 [2000-07-26 07:40 UTC] joey@php.net
Did you compile --with-sybase or --with-sybase-ct.
Also, what libs are you using?
IE, freetds, Sybase (what version? 11.0.3? 11.5.1? 11.9.2?)
 [2000-08-18 13:26 UTC] waldschrott@php.net
Closed due to missing user feedback.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 09:03:34 2021 UTC