# PDO odbc patch

- Thread: https://externals.io/message/51573
- Original archive: https://news-web.php.net/php.internals/51573
- Started by Elizabeth Smith on 2011-03-05T13:58:56+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #51573 — Elizabeth Smith — 2011-03-05T13:58:56+00:00

URL: https://externals.io/message/51573#51573

Morning,

I found an issue this week that exists in both odbc and pdo_odbc with
SQL Server.  The ODBC implemention of Windows returns 0 as the length
for for varchar(max) nad  nvarchar(max).  This makes the allocation of
the strings incorrect and you get back garbage pointers for the
contents.

This was a pretty easy fix for pdo_odbc, simply check if the colsize
is returned as 0 and the type is one of the varchar types, if so
always treat it as a column with "long" data.  This works perfectly
without breaking things.  Attached is a patch that works for both 5.3
and trunk, includes an additional test for the issue.

The odbc extension is turning out to be more of a pain, each function
is doing it's own fetching so it either has to be fixed for each
function, or change odbc to use a single function for all fetching,
which might break bc.

Thanks,
Elizabeth M Smith

---

## #51574 — Christopher Jones — 2011-03-05T15:48:28+00:00

URL: https://externals.io/message/51573#51574 · In reply to: #51573

>  Attached is a patch that works for both 5.3
> and trunk, includes an additional test for the issue.

Hi Elizabeth,

Can you log a bug and attach the patch?

Thanks

Chris

-- 
Email: christopher.jones@oracle.com
Tel:  +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/

---

## #51575 — Elizabeth M Smith — 2011-03-05T16:12:28+00:00

URL: https://externals.io/message/51573#51575 · In reply to: #51574

>
>
> 
>
> > […]
>
> Hi Elizabeth,
>
> Can you log a bug and attach the patch?
>
> Thanks
>
> Chris
>

Bug filed, patch attached (any reason it doesn't let you attach with 
@php.net email? that's rather silly) - http://bugs.php.net/bug.php?id=54169

AFAIk pdo_odbc doesn't have an active maintainer right now - does odbc 
either?

Thanks,
Elizabeth

---

## #51579 — Pierre Joye — 2011-03-06T13:04:14+00:00

URL: https://externals.io/message/51573#51579 · In reply to: #51575

On Sat, Mar 5, 2011 at 5:12 PM, Elizabeth M Smith
<auroraeosrose@gmail.com> wrote:
> 
> > […]
>
> Bug filed, patch attached (any reason it doesn't let you attach with
> @php.net email? that's rather silly) - http://bugs.php.net/bug.php?id=54169


Not sure what you meant here, but using @php.net works just fine as
in: first login then report bugs and add patches. I do that all the
time.

> AFAIk pdo_odbc doesn't have an active maintainer right now - does odbc
> either?

ODBC has maintainers, iODBC guys afair. In any case, reporting issues
to bugs.php.net is good practice anyway :)

-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
