|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48186 Symbol with code 0 in the 255 position of a string
Submitted: 2009-05-08 03:10 UTC Modified: 2015-09-20 04:22 UTC
Avg. Score:4.1 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:3 (60.0%)
From: aiskrenkov at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: PDO ODBC
PHP Version: 5.2.9 OS: Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-05-08 03:10 UTC] aiskrenkov at gmail dot com
Windows Server 2003 EE
MS SQL server 8.0.818 (MSDE 2000)
PHP 5.2.6(or high) as ISAPI or cli

I have a table 'session':
       [id] [char](32) NOT NULL DEFAULT (''),
       [expiry] [bigint] NOT NULL DEFAULT ('0'),
       [data] [ntext] NOT NULL DEFAULT ('')
When I retrive data from table and size of data more then 255 bytes, I found symbol with code 0(as EOL for strings) in the 255 position of the string.

Reproduce code:
    $dbname = "session_db";
    $username = "sa";
    $pw = "1q2w3e";
    $pdo = new PDO ("odbc:session_db","sa","1q2w3e");

    $query = $pdo->query("delete from session");
    $string = '--';	
    $string .= '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';
    $string .= '--';	

    echo 'Length of source string: '.strlen($string)."\n";

    $query = $pdo->query("insert into session values('".md5(time())."', ".time().", '".$string."')");
    $rowset = $pdo->query("select * from session");
    if($rowset === false) {

    $string = $rowset->fetchAll();
    //$string = $rowset->fetchColumn(2);
    echo 'Length of target string: '.strlen($string[0][2])."\n";

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-08 14:36 UTC]
-Status: Open +Status: Feedback -Package: ODBC related +Package: PDO ODBC -Assigned To: +Assigned To: cmb
 [2015-09-08 14:36 UTC]
Is that still an issue with recent PHP versions?
 [2015-09-20 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 07:01:30 2024 UTC