#50021 [Opn]: Predefined Statements doesn't allow Strings with more than 256 letters.

From: Date: Thu, 29 Oct 2009 17:07:42 +0000
Subject: #50021 [Opn]: Predefined Statements doesn't allow Strings with more than 256 letters.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144081@lists.php.net to get a copy of this message
ID: 50021 User updated by: novitools dot novi at web dot de Reported By: novitools dot novi at web dot de Status: Open Bug Type: MySQLi related Operating System: Windows Vista PHP Version: 5.3.0 New Comment: When I run the test from hellbringer at gmail dot com I get a different result. Also the MySQL-Versions are different: string(5) "5.3.0" int(50137) int(50137) int(10) 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 befo" Are there any setting that can cause this problem? Previous Comments: ------------------------------------------------------------------------ [2009-10-29 16:26:39] hellbringer at gmail dot com Works for me in PHP 5.3.0: <?php $db = new mysqli('localhost', 'root', ''); $stmt = $db->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.'"; $stmt->prepare($sql); $stmt->execute(); $stmt->bind_result($text); $stmt->fetch(); $stmt->close(); var_dump(phpversion()); var_dump($db->client_version); var_dump($db->server_version); var_dump($db->protocol_version); var_dump($text); ?> Output: string(5) "5.3.0" int(50005) int(50132) int(10) string(288) "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." ------------------------------------------------------------------------ [2009-10-27 17:42:34] novitools dot novi at web dot de 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 this bug report at http://bugs.php.net/?id=50021&edit=1

« previous php.bugs (#144081) next »