Bug #79277 [PATCH]: pdo_odbc accessing SAP 16.0 ASE Fatal error: Allowed memory size ...
| From: | khleung@isfactory.com | Date: | Sun, 16 Feb 2020 06:19:00 +0000 |
| Subject: | Bug #79277 [PATCH]: pdo_odbc accessing SAP 16.0 ASE Fatal error: Allowed memory size ... | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225598@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79277&edit=1
ID: 79277
Patch added by: khleung@isfactory.com
Reported by: khleung at isfactory dot com
Summary: pdo_odbc accessing SAP 16.0 ASE Fatal error: Allowed
memory size ...
Status: Feedback
Type: Bug
Package: PDO ODBC
Operating System: CentOS 7
PHP Version: 7.4.2
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: odbc_tracelog_revised
Revision: 1581833940
URL: https://bugs.php.net/patch-display.php?bug=79277&patch=odbc_tracelog_revised&revision=1581833940
Previous Comments:
------------------------------------------------------------------------
[2020-02-16 06:08:07] khleung at isfactory dot com
The following patch has been added/updated:
Patch Name: odbc_tracelog
Revision: 1581833287
URL: https://bugs.php.net/patch-display.php?bug=79277&patch=odbc_tracelog&revision=1581833287
------------------------------------------------------------------------
[2020-02-15 17:11:24] cmb@php.net
Could you please provide an ODBC trace? Make sure that it
contains no sensitive info before you post it.
------------------------------------------------------------------------
[2020-02-15 15:43:54] khleung at isfactory dot com
Description:
------------
Having installed
php 7.4.2 on CentOS 7 1804 64-bit (3.10.0-1062.12.1.el7.x86_64) on a VMware host :
2 GB ram, 250G HardDisk and 1 CPU Core.
PHP and necessary modules are installed via yum install php and also by compiling using source from
php-7.4.2.tar.gz
With SAP SDK for ASE binary file SDKASE160003P_7-21012007.TGZ installed
A testing script was prepared to check the connecting
It works fine to query a simple varchar(3) with
"SELECT name FROM sysusers ORDER BY uid ASC"
but it crashed :
SELECT name, environ FROM sysusers ORDER BY uid ASC
or even
SELECT top 1 name, environ FROM sysusers ORDER BY uid ASC
with following message:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4294967320 bytes)
in /home/sybase/sybconnect1.php on line 16
sysusers table layout as follow
Column_name Type Length Prec Scale Nulls
----------- -------- ------ ---- ----- -----
suid int 4 NULL NULL 0
uid int 4 NULL NULL 0
gid int 4 NULL NULL 0
name char 30 NULL NULL 0
environ varchar 255 NULL NULL 1
user_status smallint 2 NULL NULL 0
via UnixODBC Client tool : isql
/bin/isql SB007H sa [sapassword]
all of the above query works perfectly without any error
Test script:
---------------
[sybase@nagioshost lib]$ vi sybconnect.php
<?php
//PDO Driver Connect to Sybase
try {
//$pdo = new PDO("odbc:Driver={Adaptive Server
Enterprise};NA=lx007hsyb,5000;Uid=sa;Pwd=[sapassword];");
$pdo = new PDO("odbc:SB007H", "sa", "[sapassword]");
$pdo_status = "dsn: odbc:SB007H Connected to ASE 16\n";
echo $pdo_status;
$getUsers = $pdo->prepare('SELECT name FROM sysusers ORDER BY uid ASC');
while ($row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT)) {
$data = $row[0] . "\t" . $row[1] . "\t" . $row[2] . "\n";
print $data;
}
$stmt = null;
$getUsers->execute();
$users = $getUsers->fetchAll();
if ($users) {
foreach ($users as $user) {
echo $user['name']."\n";
}
} else {
trigger_error('No users.');
}
} catch(PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
:wq
Expected result:
----------------
sysusers contains only 20 rows and so it was expected
All query result set can shown
Actual result:
--------------
pdo_odnc FetchAll queries with column of varchar(255) crashed
with following message:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4294967320 bytes)
in /home/sybase/sybconnect1.php on line 16
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79277&edit=1