[PHP-BUG] Bug #62046 [NEW]: mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()

2012-05-16 Thread and...@php.net
From: 
Operating system: All
PHP version:  5.3Git-2012-05-16 (Git)
Package:  MySQLi related
Bug Type: Bug
Bug description:mysqli@mysqlnd can't iterate over stored sets after call to 
mysqli_stmt_reset()

Description:

 mysqlnd's implementation of stmt_reset() has a bug, that stored results
sets exist but cannot be read if mysqli_stmt::reset() is called. After
reset the data is unavailable.

Test script:
---
prepare('SELECT 42');
$s->execute();
$s->store_result();
$one = NULL;
$s->bind_result($one);
$s->reset();
while ($s->fetch()) {
  var_dump($one);
}
$s->close();
$c->close();
?>

Expected result:

int(42)

Actual result:
--
nothing

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



[PHP-BUG] Bug #51647 [NEW]: Certificate file without private key (pk in another file) doesn't work

2010-04-23 Thread and...@php.net
From: 
Operating system: Linux
PHP version:  5.3SVN-2010-04-23 (SVN)
Package:  OpenSSL related
Bug Type: Bug
Bug description:Certificate file without private key (pk in another file) 
doesn't work

Description:

If a user has a certificate file (pem) with only the public key, and the
private key in another file he cannot use them by pushing down to the
stream by using a context. The user is forced to put keys in the same file,
which is not always possible.

Test script:
---
>From the sources:

if (VCWD_REALPATH(certfile, resolved_path_buff)) {

/* a certificate to use for authentication */

if (SSL_CTX_use_certificate_chain_file(ctx, 
resolved_path_buff) != 1) {

php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Unable to set local cert
chain file `%s'; Check that your cafile/capath settings include details of
your certificate and its issuer", certfile);

return NULL;

}



if (SSL_CTX_use_PrivateKey_file(ctx, resolved_path_buff,
SSL_FILETYPE_PEM) != 1) {

php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Unable to set private key
file `%s'", resolved_path_buff);

return NULL;

}




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



[PHP-BUG] Bug #52082 [NEW]: character_set_client & character_set_connection reset after mysqli_change_user

2010-06-14 Thread and...@php.net
From: 
Operating system: All
PHP version:  5.3SVN-2010-06-14 (SVN)
Package:  MySQLi related
Bug Type: Bug
Bug description:character_set_client & character_set_connection reset after 
mysqli_change_user

Description:

After calling mysqli_change_user() character_set_client and
character_set_result are reset to the server defaults. If the client has
set a different one with mysqli_options() or mysqli_set_character_set() it
will be lost.

The MySQL server supports from version 5.1.23 setting of a charset during
COM_CHANGE_USER, an extension in the protocol. Older versions doesn't
support it and need explicit call to mysql_set_character_set().

Expected result:

Keep the old character_set_client/connection.


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



[PHP-BUG] Bug #52654 [NEW]: mysqli doesn't install headers with structures it uses

2010-08-20 Thread and...@php.net
From: 
Operating system: Linux
PHP version:  5.3SVN-2010-08-20 (SVN)
Package:  MySQLi related
Bug Type: Bug
Bug description:mysqli doesn't install headers with structures it uses

Description:

mysqli declares in php_mysqli_structs.h structures which internally are
used. One of these is MY_MYSQL. However, if another extension wants to make
use of a mysqli object it has no chance to decode it, because
php_mysqli_structs.h is not installed.



Expected result:

Split php_mysqli_structs.h in two header files : one really public and one
private. Install the public one.


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



[PHP-BUG] Bug #52745 [NEW]: Binding params doesn't work when selecting a date inside a CASE-WHEN

2010-08-30 Thread and...@php.net
From: 
Operating system: all
PHP version:  5.3.3
Package:  MySQLi related
Bug Type: Bug
Bug description:Binding params doesn't work when selecting a date inside a 
CASE-WHEN

Description:

This is MySQL Bug #49406 Binding params doesn't work when selecting a date
inside a CASE-WHEN



Description:

When querying a date field (must be type "date"!) inside a CASE-WHEN block,
the

result-binding fails (does return only empty or incorrect values for all
selected

fields), when using the prepare()/execute() API-functions. When using the
query()

API-function instead, it works as expected.



Sample query:



SELECT CASE

  WHEN 0 THEN CAST('2009-12-03' AS DATE)

  ELSE CAST('2009-12-03' AS DATE)

END



When skipping the CASE-WHEN and selecting the ELSE-value directly, it works
always as

expected (with both API-functions):



SELECT CAST('2009-12-03' AS DATE)



In summary, this three conditions must be true, to reproduce the problem:

- Result-parameter binding using bind_result() must be used

- one selected column using CASE-WHEN

- the fields inside this CASE-WHEN must be from type date



How to repeat:

I reproduced this with PHP mysqli client, but I guess the root of the
problem is

independent from the client:



query($query);

$rowViaMysqli = $result->fetch_row();

$valueViaMysqli = $rowViaMysqli[0];



echo "Fetched via mysqli::query():\n";

var_dump($valueViaMysqli);



// Always correct output:

// output: string(10) "2009-12-03"



// via mysqli::prepare/execute:

$stmt = $dbMysqli->prepare($query);

$stmt->execute();

$stmt->store_result();

$valueViaMysqli = null;

$stmt->bind_result($valueViaMysqli);

$stmt->fetch();



echo "\nFetched via
mysqli::prepare/execute/store_result/bind_result/fetch:\n";

var_dump($valueViaMysqli);



// Different output on different clients/servers, but always wrong:

// output on PHP 5.2/MySQL 5.1.37: null

// output on PHP 5.3/MySQL 5.1.38: string(11) "12338-48-57"




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



[PHP-BUG] Bug #52891 [NEW]: Wrong data inserted with mysqli/mysqlnd when using bind_param,value>LONG_MAX

2010-09-19 Thread and...@php.net
From: 
Operating system: All
PHP version:  5.3SVN-2010-09-20 (SVN)
Package:  MySQLi related
Bug Type: Bug
Bug description:Wrong data inserted with mysqli/mysqlnd when using 
bind_param,value>LONG_MAX

Description:

LONG_MAX is differs from platform to platform. 

Because zval internally uses a signed long for integer fields when the
value in the script is over LONG_MAX, or under -LONG_MAX-1 then the value
is fit into a double. When using mysqli_stmt_bind_param with such a value
and "i" modifier then the value is converted back to long, which results in
incorrect results - like if the VALUE was LONG_MAX+1 the result will be -1
(internally it is a signed long).

Test script:
---
CREATE TABLE tint(a bigint unsigned);





./php -r
'$c=mysqli_connect("127.0.0.1","root","root","test");$s=$c->prepare("insert
into tint
values(?)");$param=4294967295;$s->bind_param("i",$param);var_dump($s->execute());'

bool(true)

Expected result:

Don't bork the data. Check if the value can't be fit into a long, and if
this is the case use string to send to the server (changing the modifier to
"s" just for the next execution, preserve "i" for further executions).

Actual result:
--
-1

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



[PHP-BUG] Bug #55582 [NEW]: mysqli_num_rows() returns always 0 for unbuffered, when mysqlnd is used

2011-09-05 Thread and...@php.net
From: 
Operating system: all
PHP version:  5.4SVN-2011-09-05 (SVN)
Package:  MySQLi related
Bug Type: Bug
Bug description:mysqli_num_rows() returns always 0 for unbuffered, when mysqlnd 
is used

Description:

 As the description says, there is wrong check in mysqli, which doesn't
allow the mysqlnd code to run. mysqli returns always 0 for num_rows() even
if the whole result set has been read. This bug exists since 5.3.0, which
first bundled mysqli with mysqlnd.

Test script:
---
./php -r
'$c=mysqli_connect("127.0.0.1","root","root","test");var_dump($c->real_query("SELECT
1"));var_dump($res=$c->use_result(), mysqli_num_rows($res),
$res->fetch_assoc(), mysqli_num_rows($res), $res->fetch_assoc(),
mysqli_num_rows($res));'

Expected result:

Warning: mysqli_num_rows(): Function cannot be used with MYSQL_USE_RESULT
in Command line code on line 1

Warning: mysqli_num_rows(): Function cannot be used with MYSQL_USE_RESULT
in Command line code on line 1
object(mysqli_result)#2 (5) {
  ["current_field"]=>
  int(0)
  ["field_count"]=>
  int(1)
  ["lengths"]=>
  array(1) {
[0]=>
int(1)
  }
  ["num_rows"]=>
  int(1)
  ["type"]=>
  int(0)
}
int(0)
array(1) {
  [1]=>
  string(1) "1"
}
int(0)
NULL
int(1)  - here is the difference

Actual result:
--
Warning: mysqli_num_rows(): Function cannot be used with MYSQL_USE_RESULT
in Command line code on line 1

Warning: mysqli_num_rows(): Function cannot be used with MYSQL_USE_RESULT
in Command line code on line 1
object(mysqli_result)#2 (5) {
  ["current_field"]=>
  int(0)
  ["field_count"]=>
  int(1)
  ["lengths"]=>
  array(1) {
[0]=>
int(1)
  }
  ["num_rows"]=>
  int(1)
  ["type"]=>
  int(0)
}
int(0)
array(1) {
  [1]=>
  string(1) "1"
}
int(0)
NULL
int(0) --- should have been 1

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