Bug #17719 Updated: Code Garbage in Longtext results

From: Date: Mon, 24 Jun 2002 21:43:51 +0000
Subject: Bug #17719 Updated: Code Garbage in Longtext results
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-11979@lists.php.net to get a copy of this message
ID: 17719 Updated by: kalowsky@php.net Reported By: php@remove.gustl.net -Status: Open +Status: Feedback Bug Type: ODBC related Operating System: W98,W2K PHP Version: 4.2.1 New Comment: Please realize that while database A may support functionality MNOP, ODBC functionality is NOT assured. To answer the question, no I do not use an MS database. My testing comes from using iODBC and unixODBC ODBC drivers, and Virtuoso and PostgreSQL-ODBC for functionality. Previous Comments: ------------------------------------------------------------------------ [2002-06-24 17:31:53] php@remove.gustl.net do you use a mssql database? then you can create the table with the mssql enterprise manager, or a can open you a mssql test access on my server, Gustav Graf ------------------------------------------------------------------------ [2002-06-24 17:16:32] kalowsky@php.net Unfortunately I cannot test this. My local database dies upon trying to create a table with type NTEXT via ODBC. ------------------------------------------------------------------------ [2002-06-24 17:10:41] php@remove.gustl.net No, I cannot change the table definitions, because they are parts of an existing application. I was very happy to find out the "SET TEXTSIZE" trick, do get access to the NTEXT columns, without that PHP was and is still crashing. But something must have changed from PHP version 4.1.1 to 4.2.1, that this is not working any more. Reminds me a littlebit on that error I had with an WinXP Apache 1.3.19 installation, where I got simmilar code garbage in html results, I found a patch for apache to fix that, maybe that helps Gustav Graf ------------------------------------------------------------------------ [2002-06-24 09:29:55] kalowsky@php.net Seeing your code my initial reaction is... NTEXT is not a valid ODBC type. At least not in ODBC v2 which what PHP is using (it is valid in OBDC 3.5/3.7). Any chance you can use VARCHAR, which is a valid ODBC type? ------------------------------------------------------------------------ [2002-06-14 16:40:34] php@remove.gustl.net here is my sample script: <?PHP echo "big db test<br>"; $max = 10000; $db = odbc_connect ($DB, $DBAppUser, $DBAppPass) or die ("no connect"); $res = odbc_exec ($db, "SET TEXTSIZE ".(2 * $max)); $res = odbc_exec ($db, "DROP TABLE Test"); $res = odbc_exec ( $db, "CREATE TABLE test ( TEST_ID int NOT NULL IDENTITY PRIMARY KEY, TEST_TEXT ntext NULL )"); $text = ""; for ($i = 0; strlen ($text) < $max; $i++) $text .= "$i\n"; echo strlen ($text)." chars written<br>"; $res = odbc_exec ($db, "INSERT INTO Test (TEST_TEXT) VALUES ('$text')"); $res = odbc_exec ($db, "SELECT TEST_TEXT FROM Test WHERE TEST_ID = 1"); odbc_longreadlen ($res, $max); $text = odbc_result ($res, "TEST_TEXT"); echo strlen ($text)." chars received<br>"; echo "<listing>".htmlentities($text)."</listing>"; echo "done"; ?> with PHP 4.2.1 I get following response: big db test 10000 chars written 15904 chars received 0 1 2 <.. all ok until > 1039 1040 1± È<66 1767 1768 <.. all ok until > 2220 2221 ')' @²> tz0É$€t ×ô?< ôÈlÉ#€|Éèx€B$ 0É ¡ TEST_TEXT<> (¢!>0 1 2 <.. not ok double values starting again from 1> 1039 1040 1± È< done with PHP 4.1.1 I get: big db test 10000 chars written 10000 chars received 0 1 2 <.. all values ok> 2220 2221 done maybe I make a mistake when switching PHP versions: I just rename the directories and copy the corrsponding php4ts.dll into the windows system dir (c:\windows\system on win98; c:\winnt\system32 on w2k)? Just the zlib extension is loaded. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/17719 -- Edit this bug report at http://bugs.php.net/?id=17719&edit=1

« previous php.bugs (#11979) next »