Bug #64132 [Com]: PDO/MySQL query fails when binding a float value with data type PDO::PARAM_INT

2013-03-12 Thread u...@php.net
Edit report at https://bugs.php.net/bug.php?id=64132&edit=1

 ID: 64132
 Comment by:     u...@php.net
 Reported by:ipernet at gmail dot com
 Summary:PDO/MySQL query fails when binding a float value
 with data type PDO::PARAM_INT
 Status: Open
 Type:   Bug
 Package:PDO related
 Operating System:   Slackware 13 x64
 PHP Version:5.4.11
 Block user comment: N
 Private report: N

 New Comment:

Yet another PDO core bug that is not a MySQL bug... 

PDO converts 1.25 to 1,25 as part of the statement emulation, puts 1,25 in the 
statement string and your query becomes INSERT INTO (col) VALUES (1,25).


Previous Comments:

[2013-02-11 09:51:29] ipernet at gmail dot com

Important note:

This only happens if the set locale use a comma as decimal separator. 

Please add "setlocale(LC_ALL, 'fr_FR');" at the beginning of the test code to 
reproduce. 

This is still an unexpected behavior.


[2013-02-02 15:14:14] ipernet at gmail dot com

Description:

PHP:
5.4.11

PDO Client API version:
mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $ 

MySQL:
5.5.18-log

Using a PDO prepared statement to insert a new row, the query fails if a float 
value is passed for a token and this token use PDO::PARAM_INT as data type.

Test script:
---
CREATE TABLE IF NOT EXISTS `test` (
  `kms` int(10) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
---


$query  =   $dbh->prepare('INSERT INTO test(kms) VALUES(:kms)');

$query->bindValue(':kms',  1.25, PDO::PARAM_INT);
$query->execute();

var_dump($query->errorInfo());

Expected result:

- "1" should be inserted in the table
- Query should execute properly and do not lead to a SQL parsing error.

Actual result:
--
array(3) {
  [0] =>
  string(5) "21S01"
  [1] =>
  int(1136)
  [2] =>
  string(47) "Column count doesn't match value count at row 1"
}






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64132&edit=1


Bug #64549 [Com]: mysqlnd persistent connection handling out of control

2013-06-07 Thread u...@php.net
Edit report at https://bugs.php.net/bug.php?id=64549&edit=1

 ID: 64549
 Comment by:     u...@php.net
 Reported by:rgagnon24 at gmail dot com
 Summary:mysqlnd persistent connection handling out of
 control
 Status: Open
 Type:   Bug
 Package:MySQL related
 Operating System:   CentOS 5.9
 PHP Version:5.3.23
 Block user comment: N
 Private report: N

 New Comment:

PDO - that's the thing that does its own pooling, isn't it? Wondering if this 
is MySQL specific at all...


Previous Comments:

[2013-04-02 16:48:20] rgagnon24 at gmail dot com

Question:  Why is there a gtk window git pull request recorded on this bug?


[2013-04-02 16:47:07] rgagnon24 at gmail dot com

Another thing that is probably related to this...

PDO constructor can emit a warning that it really should not be able to.  It 
just doesn't make any sense:

PHP Warning:  PDO::__construct(): MySQL server has gone away in  on 
line 

This can happen when PDO::ATTR_PERSISTENT => true is passed during PDO 
construction, as in:

$dbh = new PDO($dsn_str, $user_name, $password, array(PDO::ATTR_PERSISTENT => 
true));

A warning like "mysql server has gone away" doesn't make any sense here.  What 
seems to be happening is that the underlying mysqlnd code is finding a 
connection in its pool that has died, and it performs a reconnect for you, but 
the warning is still emitted on the connection.

You would think if you can't connect, that a PDOException would be raised.  No 
exception is raised because the connection is in fact returned in a working 
condition, but the warning is still emitted to the error system.

The only workaround I could find was to prefix the statement with "@" as in

$dbh = @new PDO($dsn_str, $user_name, $password, array(PDO::ATTR_PERSISTENT => 
true));

Any REAL connection exception is still raised, but at least the fake warning is 
suppressed.


[2013-03-29 16:55:27] rgagnon24 at gmail dot com

Description:

When PHP 5.3 is compiled with 
   --enable-mysqlnd=shared
   --with-mysql=shared,mysqlnd
   --with-mysqli=shared,mysqlnd
   --with-pdo-mysql=shared,mysqlnd

In order to use the native driver, persistent connections using PDO don't 
appear to use any kind of managable or determinate connection pooling.

Running the test script below via apache web server, refreshing the page every 
few seconds (10 or 12 times), will produce at least 10 connections to the 
database as shown by the mysql "SHOW PROCESSLIST" command...  yet the phpinfo() 
section will indicate a number that is not the same as the actual number of 
connections.

In my test prior to posting, I had 10 actual connections (of which 9 were 
sleeping, and the 10th one was just used to run the test query) and phpinfo() 
showed 5 active_persistent_connections, and pconnect_success was 8 (under the 
mysqlnd stats section).

This leads me to believe there may be a memory leak in the area of code where 
the module is managing the connection pool.  If no memory leak, the management 
of the connections is off somehow as idle connections to a production webserver 
are ridiculously high.  




Test script:
---
 true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
);
$host_name = 'database_host';
$database_name = 'some_database';
$port = 3306;
$username = 'db_user';
$password = 'db_pass';

$dsn = sprintf("mysql:host=%s;dbname=%s;port=%d",
$host_name, $database_name, $port);

$dbh = new PDO($dsn, $username, $password, $options);
$sql = 'SELECT * FROM test WHERE id=1 LIMIT 1';

print "";
$stmt = $dbh->query($sql, PDO::FETCH_ASSOC);
while ($row = $stmt->fetch()) {
var_dump($row);
}
$stmt->closeCursor();

print '';

Expected result:

active_persistent_connections and pconnect_success should be accurate to match 
what you are really doing.  Also the command line 'netstat -anp|grep :3306|grep 
httpd|grep ESTABLISHED" should show a limit at some point on the number of 
connections that are persistent, or they should get re-used.

Actual result:
--
There are a lot of unaccounted for idle ESTABLISHED in the netstat command, for 
connections from httpd to mysql when mysqlnd indicates there are not that many.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64549&edit=1


#49948 [NEW]: stream_select() / _get_osfhandle

2009-10-21 Thread u...@php.net
From: u...@php.net
Operating system: Windows
PHP version:  5.3SVN-2009-10-21 (snap)
PHP Bug Type: Streams related
Bug description:  stream_select() / _get_osfhandle

Description:

Hi,

I am getting "Invalid parameter detected in CRT function '_get_osfhandle'"
when running the below code. 

I have compiled a source code snapshot version of PHP 5.3.2-dev on
Windows. I used VC9 Express and SDK 6.1 . OS is XP Prof. I've run PHP from
within the build tree in the hope it will pick the binaries (dlls, resource
files, whatever there is) I have compiled myself. 

However, I have also seen this warning with yesterdays VC9 non TS binaries
from the windows.php.net on another box. A couple of ext/mysqli tests fail
because of the warning. The affected mysqli API calls is mysqli_poll(). It
makes use of [php_]select() just like the below code.

Reproduce code:
---
$stream = stream_socket_client("tcp://193.99.144.80:80", $errno, $error,
$whatever, STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_CONNECT);
var_dump($stream);
$read = $write = $except = array($stream);
var_dump(stream_select($read, $write, $except, 1));

Expected result:

No warning. 

Actual result:
--
resource(5) of type (stream)

Warning: Invalid parameter detected in CRT function '_get_osfhandle'
(f:\dd\vctools\crt_bld\self_x86\crt\src\osfinfo.c:314) in
E:\php-sdk\php53dev\vc9\x86\php5.
3-200910211230\Debug_TS\select.php on line 5
int(1)

-- 
Edit bug report at http://bugs.php.net/?id=49948&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49948&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49948&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49948&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49948&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49948&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49948&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=49948&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=49948&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=49948&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=49948&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=49948&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=49948&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=49948&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49948&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=49948&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=49948&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=49948&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=49948&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=49948&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=49948&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=49948&r=mysqlcfg



[PHP-BUG] Bug #55653 [NEW]: PS crash with libmysql when binding same variable as param and out

2011-09-09 Thread u...@php.net
From: 
Operating system: 
PHP version:  5.4SVN-2011-09-09 (SVN)
Package:  MySQLi related
Bug Type: Bug
Bug description:PS crash with libmysql when binding same variable as param and 
out

Description:

This will crash, if using mysqli with libmysql.

 sapi/cli/php -r '$link = new mysqli("192.168.2.27", "root", "", "test");
$stmt = $link->stmt_init(); $in = "a"; $stmt->prepare("SELECT ?");
$stmt->bind_param("s", $in); $stmt->execute(); $stmt->bind_result($in);
$stmt->fetch(); var_dump($in);'

/home/nixnutz/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c(890) : Block
0x071e5870 status:
Invalid pointer: ((size=0x005976c6) != (next.prev=0x))
==12847== Conditional jump or move depends on uninitialised value(s)
==12847==at 0x81C242: zend_mm_check_ptr (zend_alloc.c:1388)
==12847==by 0x81C230: zend_mm_check_ptr (zend_alloc.c:1385)
==12847==by 0x81DDA6: _zend_mm_free_int (zend_alloc.c:2064)
==12847==by 0x81F350: _efree (zend_alloc.c:2436)
==12847==by 0x5F412E: mysqli_stmt_fetch_libmysql (mysqli_api.c:890)


Box 1:

mysqli

MysqlI Support => enabled
Client API library version => 5.6.2-m5
Active Persistent Links => 0
Inactive Persistent Links => 0
Active Links => 0
Client API header version => 5.6.2-m5
MYSQLI_SOCKET => /tmp/mysql.sock


Box 2:

mysqli

MysqlI Support => enabled
Client API library version => 5.1.45
Active Persistent Links => 0
Inactive Persistent Links => 0
Active Links => 0
Client API header version => 5.1.45
MYSQLI_SOCKET => /tmp/mysql.sock





Test script:
---
 sapi/cli/php -r '$link = new mysqli("192.168.2.27", "root", "", "test");
$stmt = $link->stmt_init(); $in = "a"; $stmt->prepare("SELECT ?");
$stmt->bind_param("s", $in); $stmt->execute(); $stmt->bind_result($in);
$stmt->fetch(); var_dump($in);'




-- 
Edit bug report at https://bugs.php.net/bug.php?id=55653&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55653&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55653&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55653&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55653&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55653&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55653&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55653&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55653&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55653&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55653&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55653&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55653&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55653&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55653&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55653&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55653&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55653&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55653&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55653&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55653&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55653&r=mysqlcfg



[PHP-BUG] Bug #55859 [NEW]: mysqli->stat property access gives error

2011-10-06 Thread u...@php.net
From: uw
Operating system: 
PHP version:  5.4SVN-2011-10-06 (SVN)
Package:  MySQLi related
Bug Type: Bug
Bug description:mysqli->stat property access gives error

Description:

 sapi/cli/php -r '$mysqli = new mysqli("localhost", "root", "", "test");
var_dump(mysqli_stat($mysqli)); var_dump($mysqli->stat);'
string(140) "Uptime: 2059747  Threads: 1  Questions: 126152  Slow queries:
0  Opens: 6377  Flush tables: 1  Open tables: 18  Queries per second avg:
0.61"
PHP Notice:  Undefined property: mysqli::$stat in Command line code on line
1
NULL

According to the docs there should be mysqli->stat,
http://www.php.net/manual/en/mysqli.stat.php

Test script:
---
 sapi/cli/php -r '$mysqli = new mysqli("localhost", "root", "", "test");
var_dump(mysqli_stat($mysqli)); var_dump($mysqli->stat);'
string(140) "Uptime: 2059747  Threads: 1  Questions: 126152  Slow queries:
0  Opens: 6377  Flush tables: 1  Open tables: 18  Queries per second avg:
0.61"
PHP Notice:  Undefined property: mysqli::$stat in Command line code on line
1
NULL


Expected result:

Fix code or docs.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=55859&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55859&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55859&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55859&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55859&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55859&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55859&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55859&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55859&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55859&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55859&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55859&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55859&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55859&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55859&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55859&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55859&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55859&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55859&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55859&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55859&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55859&r=mysqlcfg



[PHP-BUG] Bug #55860 [NEW]: mysqli_refresh still exists and is undocumented

2011-10-06 Thread u...@php.net
From: uw
Operating system: 
PHP version:  5.4SVN-2011-10-06 (snap)
Package:  MySQLi related
Bug Type: Bug
Bug description:mysqli_refresh still exists and is undocumented

Description:

mysqli_refresh() exists in 5.4

 sapi/cli/php -r 'mysqli_refresh("foo");'
PHP Warning:  mysqli_refresh() expects exactly 2 parameters, 1 given in
Command line code on line 1


According to the documentation is it only available until 5.3

nixnutz@linux-fuxh:~/php/phpdoc> grep -R refresh en/reference/mysqli/
en/reference/mysqli/versions.xml: 
en/reference/mysqli/.svn/text-base/versions.xml.svn-base: 



Test script:
---
See above

Expected result:

Either update docs or remove function ?! Deprecate it at least...


-- 
Edit bug report at https://bugs.php.net/bug.php?id=55860&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55860&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55860&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55860&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55860&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55860&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55860&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55860&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55860&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55860&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55860&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55860&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55860&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55860&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55860&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55860&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55860&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55860&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55860&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55860&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55860&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55860&r=mysqlcfg



[PHP-BUG] Bug #60119 [NEW]: host="localhost" lost in mysqlnd_ms_get_last_used_connection()

2011-10-24 Thread u...@php.net
From: uw
Operating system: 
PHP version:  Irrelevant
Package:  mysqlnd_ms
Bug Type: Bug
Bug description:host="localhost" lost in mysqlnd_ms_get_last_used_connection()

Description:

mysqlnd_ms_get_last_used_connection() reports wrong host, if host is
"localhost". In that case, the host reported is "".



Test script:
---
Tests in the repository fail, if configured appropriately.

FAILED TEST SUMMARY  
-
mysqlnd_ms_get_last_used_connection()
[/home/nixnutz/php/php-src/pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_get_last_used_connection.phpt]
mysqlnd_ms_get_last_used_connection() switching
[/home/nixnutz/php/php-src/pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_get_last_used_connection_switches.phpt]


Expected result:

host="localhost" not host=""

Actual result:
--
host=""

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60119&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60119&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60119&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=60119&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60119&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60119&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60119&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=60119&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=60119&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=60119&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=60119&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=60119&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=60119&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=60119&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60119&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=60119&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=60119&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=60119&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=60119&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=60119&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=60119&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=60119&r=mysqlcfg