Bug #70869 [Opn->Wfx]: mssql_fetch_batch tries to allocate 4GB memory
Edit report at https://bugs.php.net/bug.php?id=70869&edit=1
ID: 70869
Updated by: kalle@php.net
Reported by: m dot subotovic at gmail dot com
Summary: mssql_fetch_batch tries to allocate 4GB memory
-Status: Open
+Status: Wont fix
Type: Bug
Package: MSSQL related
Operating System: Linux
PHP Version: 5.4.45
Block user comment: N
Private report: N
New Comment:
With MSSQL being removed from PHP as of PHP7.0, and ext/mssql not having a maintainer, I'm
gonna close this report as a Won't fix, until maybe one day it will find a new maintainer.
Alternatively you can use sqlsrv from Microsoft if you are on Windows, or pdo_dblib if you are on
Unix.
Previous Comments:
------------------------------------------------------------------------
[2015-11-10 09:13:51] m dot subotovic at gmail dot com
Yes, I have read this comment.
I use two different connections, not the same.
I use Microsoft SQL Server 2008 R2 (SP1) Standard Edition (64-bit) on Windows NT 6.1
------------------------------------------------------------------------
[2015-11-07 16:46:13] marcosptf at yahoo dot com dot br
have you read this comment on php doc?
http://php.net/manual/en/function.mssql-fetch-batch.php#111642
what version of sql server do you use?
Thanks
marcosptf
:D
------------------------------------------------------------------------
[2015-11-06 09:51:12] m dot subotovic at gmail dot com
Description:
------------
Fatal error: Allowed memory size of X bytes exhausted (tried to allocate 4294967296 bytes)
The error above is being shown when using mssql_fetch_batch on two different connections. Look at
the test script example.
Test script:
---------------
<?php
function fetchAssoc($link)
{
$res = mssql_fetch_assoc($link);
if ($res === false) {
if (mssql_fetch_batch($link) > 0) {
$res = mssql_fetch_assoc($link);
}
}
return $res;
}
$link1 = mssql_connect('host', 'user', 'pwd');
mssql_select_db('db', $link1);
$link2 = mssql_connect('host', 'user', 'pwd');
mssql_select_db('db', $link2);
$result1 = mssql_query("SELECT TOP 2 * FROM table", $link1, 1);
while ($row1 = fetchAssoc($result1)) {
echo "Row from 1 result\n";
$result2 = mssql_query("SELECT TOP 2 * FROM table2", $link2);
while ($row2 = fetchAssoc($result2)) {
echo "Row from 2 result\n";
}
}
echo "Done";
Expected result:
----------------
Row from 1 result
Row from 2 result
Row from 2 result
Row from 1 result
Row from 2 result
Row from 2 result
Done
Actual result:
--------------
Row from 1 result
Row from 2 result
Row from 2 result
Fatal error: Allowed memory size of X bytes exhausted (tried to allocate 4294967296 bytes)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70869&edit=1
Thread (4 messages)