php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40006 Memory leak in sybase_query()
Submitted: 2007-01-03 08:13 UTC Modified: 2007-01-07 18:59 UTC
From: aharvey@php.net Assigned:
Status: Not a bug Package: Sybase (dblib) related
PHP Version: 5CVS-2007-01-03 (CVS) OS: CentOS 4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: aharvey@php.net
New email:
PHP Version: OS:

 

 [2007-01-03 08:13 UTC] aharvey@php.net
Description:
------------
Calling sybase_query() for a SELECT query that returns multiple rows causes the memory limit to be hit or, in the case where the memory manager isn't compiled in, memory usage to increase until the PHP process is killed. I'm running Sybase ASE 15.0 on CentOS 4. The problem seems to occur both with PHP_5_2 CVS and also PHP 4.4.4. PHP was compiled with --with-sybase=/usr/local/sybase; /usr/local/sybase being the installation directory for ASE on the box in question.

This looks quite similar to bug #39508, but that's using sybase-ct instead of straight sybase.

Reproduce code:
---------------
<?php
$db = sybase_connect('LOCALHOST', 'sa', 'password') or die("Error connecting to ASE.\n");
sybase_select_db('test', $db) or die("Error selecting database.\n");
if (sybase_query("CREATE TABLE phptest (a integer)", $db))
    echo "Table created.\n";
else
    echo "Error creating table.\n";
sybase_query("INSERT INTO phptest VALUES (1)", $db) or print("Error inserting record.\n");
sybase_query("INSERT INTO phptest VALUES (2)", $db) or print("Error inserting record.\n");
echo "Records inserted, attempting select...\n";
if (sybase_query('SELECT a FROM phptest WHERE a = 1', $db))
    echo "Single row select complete.\n";
else
    echo "Single row select failed.\n";
if (sybase_query('SELECT a FROM phptest WHERE a > 0', $db))
    echo "Multiple row select complete.\n";
else
    echo "Multiple row select failed.\n";
sybase_query('DROP TABLE phptest', $db) or print("Error dropping table.\n");
sybase_close($db) or die("Error closing connection.\n");
?>

Expected result:
----------------
Table created.
Records inserted, attempting select...
Single row select complete.
Multiple row select complete.

Actual result:
--------------
Table created.
Records inserted, attempting select...
Single row select complete.

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 3434496 bytes) in /tmp/test-sybase.php on line 15

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-07 18:59 UTC] iliaa@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Dupe of #39058
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC