From:             test157 at starman dot ee
Operating system: Linux Fedora Core 4
PHP version:      4.4.0
PHP Bug Type:     MySQL related
Bug description:  LOCK TABLES with mysql_query() works wrong

Description:
------------
When I'am locking MySQL ISAM table from PHP env, all other threads still
can use this table for READ/WRITE actions. But I didn't get from
mysql_error() any message, and even cannot access other tables, untill
they not locked too. So it's seems like PHP really thinks that MySQL
locked. I think that this is problem of PHP because from MySQL console I
can lock tables succesfuly, and after this lock even PHP cannot access
this table.

Reproduce code:
---------------
mysql_pconnect("localhost","root","");
mysql_select_db("test_db");


mysql_query("LOCK TABLES `test_table_1` WRITE");
mysql_query("INSERT INTO `test_table_1` (`a`) VALUES (1)"); // returns OK
mysql_query("INSERT INTO `test_table_2` (`a`) VALUES (1)"); // Table was
not locked with LOCK TABLES 
sleep(100);
mysql_query("UNLOCK TABLES");


Expected result:
----------------
with this code I want to show you that all works fine, from side of thread
what lock MySQL table. But really nothing is locked, during this 100
seconds I can edit/read test_table_1, without any problems from other
threads. If I will even remove UNLOCK TABLES command and will use
presistent connection, I will not hang up system. Because nothing is
locked.

   

Actual result:
--------------
I tried it on PHP v 4.4.0/5.0.3/snapshots, CLI mode/Apache 2.0.54 compiled
as worker/prefork, mysql v 4.1.12,13,14. And everywhere the same picture. 
I tried to compile PHP in different ways, from --disable-all + some only
important keys, to full configs. Also tried to use budle MySQL libraries
and what install on system. But all the same.

Hope on your fast bug_fix.

P.S: Also on this system I cannot flock(file) it all the same like with
MySQL, no any error returned, but file no locked for other threads.
(FS:ext2)

-- 
Edit bug report at http://bugs.php.net/?id=33849&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33849&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33849&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33849&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33849&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33849&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33849&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33849&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33849&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33849&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33849&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33849&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33849&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33849&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33849&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33849&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33849&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33849&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33849&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33849&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33849&r=mysqlcfg

Reply via email to