From: novitools dot novi at web dot de
Operating system: Windows Vista
PHP version: 5.3.0
PHP Bug Type: MySQLi related
Bug description: Predefined Statements doesn't allow Strings with more than 256 letters.
Description:
------------
When you use Predefined Statements you can only read the first 256 words
of a string. The same error occurs, when you try to select a text column
from the database.
Reproduce code:
---------------
<?php
$Database = new mysqli('localhost', 'root', '');
// that didn't works like expected
$Statement = $Database->stmt_init();
$sql="SELECT 'You can only read the first 256 words of this text. That is
why I must write such a long text, because I must reach the limit of 256
words. The same error occours, when you try to select a text column from
the database. But I didn\'t had this error before in a previous version of
php.'";
$Statement->prepare($sql);
$Statement->execute();
$Statement->bind_result($Text);
$Statement->fetch();
$Statement->close();
var_dump($Text);
// that works like expected
$Database = new mysqli('localhost', 'root', '');
$sql="SELECT 'You can only read the first 256 words of this text. That is
why I must write such a long text, because I must reach the limit of 256
words. The same error occours, when you try to select a text column from
the database. But I didn\'t had this error before in a previous version of
php.'";
$Result = $Database->query($sql);
$Row = $Result->fetch_row();
$Result->close();
var_dump($Row[0]);
?>
Expected result:
----------------
string(284) "You can only read the first 256 words of this text. That is
why I must write such a long text, because I must reach the limit of 256
words. The same error occours, when you try to select a text column from
the database. But I didn't had this error before in a previous version of
php."
string(284) "You can only read the first 256 words of this text. That is
why I must write such a long text, because I must reach the limit of 256
words. The same error occours, when you try to select a text column from
the database. But I didn't had this error before in a previous version of
php."
Actual result:
--------------
string(256) "You can only read the first 256 words of this text. That is
why I must write such a long text, because I must reach the limit of 256
words. The same error occours, when you try to select a text column from
the database. But I didn't had this error before i"
string(284) "You can only read the first 256 words of this text. That is
why I must write such a long text, because I must reach the limit of 256
words. The same error occours, when you try to select a text column from
the database. But I didn't had this error before in a previous version of
php."
Note that the first string is only 256 words long.
--
Edit bug report at http://bugs.php.net/?id=50021&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50021&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50021&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50021&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50021&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50021&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50021&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50021&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50021&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50021&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50021&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50021&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50021&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50021&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50021&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50021&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50021&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50021&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50021&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50021&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50021&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50021&r=mysqlcfg