ID: 24244 Comment by: mb at btn dot de Reported By: bl at btn dot de Status: Feedback Bug Type: ODBC related Operating System: Red Hat Linux PHP Version: 4.3.2 New Comment:
Output of var_dump(odbc_errormsg()) as follows: string(146) "31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:" string(122) "1:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:" These are only two examples. I had to reproduce the error in a small script to generate these. That's why the variety is not that great like in our production environment where we currently use a dirty workaround. Previous Comments: ------------------------------------------------------------------------ [2003-06-18 10:24:52] [EMAIL PROTECTED] What does var_dump(odbc_error()) return after a valid query? ------------------------------------------------------------------------ [2003-06-18 06:54:21] bl at btn dot de sorry ... one more thing ... in my "Actual Results" section I forgot to remove the "or"'s ... So of course the "or"'s are not part of the string which is returned by odbc_errormsg() ... ------------------------------------------------------------------------ [2003-06-18 06:50:30] bl at btn dot de Description: ------------ We use the IBMDB2 database on our systems. The following bug occured while writing a class supposed to halt the code on database exceptions. While checking for strlen(odbc_errormsg())==0 for aborting the routine PHP sometimes (about once in four calls) returns Bad Strings (see below). Maybe the "message" is taken from an unallocated space on PHP's heap ?!? It's not that much of a problem to come up with a workaround but PHP shouldn't return random bits of the memory. Reproduce code: --------------- $link = odbc_connect("mydb", "myusr","mypwd"); $sql = "[INSERT FLAWLESS STATEMENT HERE]"; odbc_exec($link,$sql) if(strlen(odbc_errormsg())>0) { echo "SQL-Error " . odbc_errormsg(); } odbc_close($link); Expected result: ---------------- If $sql contains a valid statement odbc_errormsg() should return an empty string (according to the PHP-Documentation) Actual result: -------------- Sometimes parts of the outstream, a URL, short binary data, PHP-Variable names anything might happen ... as I mentioned above, the data might be part of PHP's heap. Some Examples: T_URI (?) or (a variable name ?) ze:12px; } .menue_common{ [... here it goes on for quite a while ...] width: 140px; margin-bottom: 2p (part of our stylesheet) or ÿÿ or (junk) Àò or (more junk) aten_I or (I have that somewhere earlier but I can't remember) -urlencoded (this shouldn't be an errormsg) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24244&edit=1