From:             [EMAIL PROTECTED]
Operating system: RedHat 7.1
PHP version:      4.0.6
PHP Bug Type:     MySQL related
Bug description:  implicit_flush (off) causes mysql to see into the future

I'll be the first to admit that this is weird ... but, after 11hours of
debugging and recompiling I can safely say that while implicit_flush is
off, mysql_query returns some odd (pre-emptive) results;


I have run an old database system (php3.0.12/mysql3.22.26a (sitting on
RH6.0)) for a couple of years .. I wanted to put that onto a new RH7.1 box
(php4.04pl1-9/mysql3.23.36-1).  Whith the same database structure, and the
same
php code (bar the mysql_affected_rows() "link id" mod) I was seeing future
mysql updates being entered into the database before current php decisions,
ie;

Table "tbl" has 1 record.  In that record, field "fldx"=0, field
"fldt"=0.

if we query the database, in one instance, and do nothing more;
          select * from tbl, echo field "fldx"
.. the screen output is the value 0.


if we add to that php program/script a function call to a function
containing further mysql queries - including updates to the field we echo
at the top of this script (above);
     function whatever (condition parameters) {
          $time = 995454806
          update tbl set fldt=$time where (conditions) and fldt=0
          if affected rows > 0  {
               select * from tbl where (conditions)
               if number rows > 0  {
                    fetch array (to retrieve fldx)
                    if fldx == 2 {
                          delete from tbl where (conditions)
                          (interim work on other tables)
                          return
                     } else {
                          update tbl set fldx=2 where (conditions)
                          (interim work on other tables)
                          update tbl set fldt=0 where (conditions) and
fldt=$time
                          return
                     }
                }
            }
            return
         }


then the onscreen output for fldx is "2".

It is as though we had gone through the program with the stored fldx value
of "0", switching through the conditions appropriately, then updating our
record (fldx) with a "2", before we proceed through the php (from the
top),
outputting our "2" then randomly tripping condition 1 (no affected rows),
or randomly tripping condition fldx==2, 
causing the record to be prematurely deleted, or randomly (far less
frequently than the prior) occuring correctly.

 ... almost as if the output caching was occuring *between* PHP and MySQL
... not between PHP and the User .. (?)

Since I had thought it was version problems with PHP/MySQL, I have compiled
up and am now running php4.06 and mysql3.23.39 -- where the problem
persisted. I have since verified that the /etc/php.ini setting
"implicit_flush" when set to "on" under the newer software, does return my
code to the former php3/expected logic.

Very strange indeed.




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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to