#37596 [NEW]: sha1_file() eating memory like so much nami

2006-05-25 Thread jlevy at imerica dot com
From: jlevy at imerica dot com
Operating system: Debian GNU/Linux
PHP version:  5.1.4
PHP Bug Type: Unknown/Other Function
Bug description:  sha1_file() eating memory like so much nami

Description:

sha1_file() not releasing memory.

After calling thousands of sha1_file() I noticed that memory resources are
not being freed. Script evenually bombs due to lack of resources.

** Note ** I think md5_file() is doing the same thing.

Reproduce code:
---
function getFiles($rdi,$depth=0) {

   if (!is_object($rdi))
   return;
 
   for ($rdi-rewind();$rdi-valid();$rdi-next()) {
 
   if ($rdi-isDot())
   continue;
 
   if ($rdi-isDir() || $rdi-isFile()) {
 
   if($rdi-isFile()
   echo sha1_file($rdi-current());
 
   if ($rdi-hasChildren())
   getFiles($rdi-getChildren(),1+$depth);
   }
   }
}

//** I figured that calling clearstatcache() might help, but no, it didn't
**//



-- 
Edit bug report at http://bugs.php.net/?id=37596edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37596r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37596r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37596r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37596r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=37596r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=37596r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=37596r=needscript
Try newer version:http://bugs.php.net/fix.php?id=37596r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=37596r=support
Expected behavior:http://bugs.php.net/fix.php?id=37596r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=37596r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=37596r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37596r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37596r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37596r=dst
IIS Stability:http://bugs.php.net/fix.php?id=37596r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=37596r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37596r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=37596r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=37596r=mysqlcfg


#37581 [NEW]: oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC

2006-05-24 Thread jlevy at imerica dot com
From: jlevy at imerica dot com
Operating system: Redhat, Debian
PHP version:  5.1.4
PHP Bug Type: Oracle related
Bug description:  oci_bind_array_by_name clobbers input array when using 
SQLT_AFC, AVC

Description:

Please note that this relates to 5.1.2, not 5.1.4.

Configuration: 
 Box #1 - PHP 5.1.2 compiled against oracle instant client 10.x,
Debian
 Box #2 - PHP 5.1.2 compiled against oracle full libs, Redhat

Calling oci_bind_array_by_name will append extraneous members to input
array if using SQLT_AFC or SQLT_AVC (other types untested due to lack of
due dilligence)

Sample script to reproduce bug at pastebin.com, see URL below.



Reproduce code:
---
http://http://pastebin.com/735456

Expected result:

Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LH
[1] = JC
[2] = PJ
)

Actual result:
--
Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LHJCPJ
[1] = JCPJ
[2] = PJ
)
Array
(
[0] = LHJCPJ
[1] = JCPJ
[2] = PJ
[3] = JCPJ
[4] = PJ
)

-- 
Edit bug report at http://bugs.php.net/?id=37581edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37581r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37581r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37581r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37581r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=37581r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=37581r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=37581r=needscript
Try newer version:http://bugs.php.net/fix.php?id=37581r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=37581r=support
Expected behavior:http://bugs.php.net/fix.php?id=37581r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=37581r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=37581r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37581r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37581r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37581r=dst
IIS Stability:http://bugs.php.net/fix.php?id=37581r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=37581r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37581r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=37581r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=37581r=mysqlcfg


#37581 [Opn]: oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC

2006-05-24 Thread jlevy at imerica dot com
 ID:   37581
 User updated by:  jlevy at imerica dot com
 Reported By:  jlevy at imerica dot com
 Status:   Open
 Bug Type: Oracle related
 Operating System: Redhat, Debian
 PHP Version:  5.1.4
 New Comment:

Apologies for bad pastebin URL. Strip the excess http:// and it should
load properly.


Previous Comments:


[2006-05-24 17:47:30] jlevy at imerica dot com

Description:

Please note that this relates to 5.1.2, not 5.1.4.

Configuration: 
 Box #1 - PHP 5.1.2 compiled against oracle instant client 10.x,
Debian
 Box #2 - PHP 5.1.2 compiled against oracle full libs, Redhat

Calling oci_bind_array_by_name will append extraneous members to input
array if using SQLT_AFC or SQLT_AVC (other types untested due to lack
of due dilligence)

Sample script to reproduce bug at pastebin.com, see URL below.



Reproduce code:
---
http://http://pastebin.com/735456

Expected result:

Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LH
[1] = JC
[2] = PJ
)

Actual result:
--
Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LHJCPJ
[1] = JCPJ
[2] = PJ
)
Array
(
[0] = LHJCPJ
[1] = JCPJ
[2] = PJ
[3] = JCPJ
[4] = PJ
)





-- 
Edit this bug report at http://bugs.php.net/?id=37581edit=1


#37581 [Opn]: oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC

2006-05-24 Thread jlevy at imerica dot com
 ID:   37581
 User updated by:  jlevy at imerica dot com
 Reported By:  jlevy at imerica dot com
 Status:   Open
 Bug Type: Oracle related
 Operating System: Redhat, Debian
 PHP Version:  5.1.4
 New Comment:

Another developer in my office verified this bug is also present in PHP
5.1.4

Thank you.


Previous Comments:


[2006-05-24 17:49:50] jlevy at imerica dot com

Apologies for bad pastebin URL. Strip the excess http:// and it should
load properly.



[2006-05-24 17:47:30] jlevy at imerica dot com

Description:

Please note that this relates to 5.1.2, not 5.1.4.

Configuration: 
 Box #1 - PHP 5.1.2 compiled against oracle instant client 10.x,
Debian
 Box #2 - PHP 5.1.2 compiled against oracle full libs, Redhat

Calling oci_bind_array_by_name will append extraneous members to input
array if using SQLT_AFC or SQLT_AVC (other types untested due to lack
of due dilligence)

Sample script to reproduce bug at pastebin.com, see URL below.



Reproduce code:
---
http://http://pastebin.com/735456

Expected result:

Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LH
[1] = JC
[2] = PJ
)

Actual result:
--
Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LHJCPJ
[1] = JCPJ
[2] = PJ
)
Array
(
[0] = LHJCPJ
[1] = JCPJ
[2] = PJ
[3] = JCPJ
[4] = PJ
)





-- 
Edit this bug report at http://bugs.php.net/?id=37581edit=1


#37581 [Fbk-Opn]: oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC

2006-05-24 Thread jlevy at imerica dot com
 ID:   37581
 User updated by:  jlevy at imerica dot com
 Reported By:  jlevy at imerica dot com
-Status:   Feedback
+Status:   Open
 Bug Type: OCI8 related
 Operating System: Redhat, Debian
 PHP Version:  5.1.4
 New Comment:

create or replace package QUOTE.MANAGE_QUOTE

is

 /**

  * collection of plan_ids

  */

  type array_plan_id is table of char(2) index by binary_integer;

  /**

   * collection of premiums for a plan and quote id

   */

   type array_premium is table of number(16,4) index by
binary_integer;

/**

 * Adds a lot of plans to quote.

 *

 * Accepts two arrays, one for plan ids and another for premium and
loads them into the database in one

 * sweep.  If the reload parameter is set to Y all existing plan
associations will be removed from

 * the database.

 *

 * @param in_quote_id in int quote id to add plans to

 * @param in_plan_id in array_plan_id integer indexed array of plans to
add

 * @param in_premium in array_premium integer indexed array of premiums
for the corresponding record in plan_id

 * @param reloadY or N.  Determines if we should flush all
plans already saved in the database

 */

procedure add_plan(in_quote_id in int, in_plan_id in array_plan_id,
in_premium in array_premium,reload in string);

end MANAGE_QUOTE;

 

create or replace package body QUOTE.MANAGE_QUOTE

as

 

procedure add_plan(in_quote_id in int, in_plan_id in array_plan_id,
in_premium in array_premium,reload in string) is

 begin

  if(reload = 'Y') then

delete quote.quote_plan where quote_id = in_quote_id;

commit;

  end if;

  for i in 1 .. in_plan_id.count loop

insert into quote.quote_plan(quote_id,plan_id,premium)
values(in_quote_id,in_plan_id(i),in_premium(i));

  end loop;

  commit;

end add_plan;

 

end MANAGE_QUOTE;


Previous Comments:


[2006-05-24 18:00:28] [EMAIL PROTECTED]

I don't think I have a quote.manage_quote.add_plan() procedure, so your
reproduce case is not very useful. 



[2006-05-24 17:51:13] jlevy at imerica dot com

Another developer in my office verified this bug is also present in PHP
5.1.4

Thank you.



[2006-05-24 17:49:50] jlevy at imerica dot com

Apologies for bad pastebin URL. Strip the excess http:// and it should
load properly.



[2006-05-24 17:47:30] jlevy at imerica dot com

Description:

Please note that this relates to 5.1.2, not 5.1.4.

Configuration: 
 Box #1 - PHP 5.1.2 compiled against oracle instant client 10.x,
Debian
 Box #2 - PHP 5.1.2 compiled against oracle full libs, Redhat

Calling oci_bind_array_by_name will append extraneous members to input
array if using SQLT_AFC or SQLT_AVC (other types untested due to lack
of due dilligence)

Sample script to reproduce bug at pastebin.com, see URL below.



Reproduce code:
---
http://http://pastebin.com/735456

Expected result:

Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LH
[1] = JC
[2] = PJ
)

Actual result:
--
Array
(
[0] = LH
[1] = JC
[2] = PJ
)
Array
(
[0] = LHJCPJ
[1] = JCPJ
[2] = PJ
)
Array
(
[0] = LHJCPJ
[1] = JCPJ
[2] = PJ
[3] = JCPJ
[4] = PJ
)





-- 
Edit this bug report at http://bugs.php.net/?id=37581edit=1


#37581 [Fbk-Opn]: oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC

2006-05-24 Thread jlevy at imerica dot com
 ID:   37581
 User updated by:  jlevy at imerica dot com
 Reported By:  jlevy at imerica dot com
-Status:   Feedback
+Status:   Open
-Bug Type: OCI8 related
+Bug Type: Oracle related
 Operating System: Redhat, Debian
 PHP Version:  5.1.4
 New Comment:

/*
 * Oracle package for test procedure. required to define user
 * defined type.
 */
create or replace package phptest as
  type str_array is table of char(2) index by binary_integer;
  /**
   * procedure accepting a char input array and a string output.
   */
  procedure array_bind(in_str in str_array, out_str out string); end
phptest; / show errors;

create or replace package body phptest as

  procedure array_bind(in_str in str_array, out_str out string) is
  begin
for i in 1 .. in_str.count loop
  out_str := in_str(i);
end loop;
  end array_bind;
end phptest;
/
show errors;



PHP Code as Follows:

$db = oci_connect('user','pass'.','server');
$stmt   = oci_parse($db,'begin phptest.array_bind(:in_arr,
:out_str); end;');

$strings= array('A','B','C','D','E');

oci_bind_array_by_name($stmt,':in_arr',$strings,5,1,SQLT_AFC);
oci_bind_by_name($stmt,':out_str',$result,10);

oci_execute($stmt);
echo values of Strings array after 1st run:\n; print_r($strings);
oci_execute($stmt); echo values of Strings array after 2nd run:\n;
print_r($strings);


Previous Comments:


[2006-05-24 18:46:06] [EMAIL PROTECTED]

Could you please just provide a dummy procedure which can help me to
replicate the problem?
I don't have quote.quote_plan table and I guess I'll need even more
tables, triggers and stored procedures just to recreate a simple
problem.
Thanks.



[2006-05-24 18:36:31] jlevy at imerica dot com

create or replace package QUOTE.MANAGE_QUOTE

is

 /**

  * collection of plan_ids

  */

  type array_plan_id is table of char(2) index by binary_integer;

  /**

   * collection of premiums for a plan and quote id

   */

   type array_premium is table of number(16,4) index by
binary_integer;

/**

 * Adds a lot of plans to quote.

 *

 * Accepts two arrays, one for plan ids and another for premium and
loads them into the database in one

 * sweep.  If the reload parameter is set to Y all existing plan
associations will be removed from

 * the database.

 *

 * @param in_quote_id in int quote id to add plans to

 * @param in_plan_id in array_plan_id integer indexed array of plans to
add

 * @param in_premium in array_premium integer indexed array of premiums
for the corresponding record in plan_id

 * @param reloadY or N.  Determines if we should flush all
plans already saved in the database

 */

procedure add_plan(in_quote_id in int, in_plan_id in array_plan_id,
in_premium in array_premium,reload in string);

end MANAGE_QUOTE;

 

create or replace package body QUOTE.MANAGE_QUOTE

as

 

procedure add_plan(in_quote_id in int, in_plan_id in array_plan_id,
in_premium in array_premium,reload in string) is

 begin

  if(reload = 'Y') then

delete quote.quote_plan where quote_id = in_quote_id;

commit;

  end if;

  for i in 1 .. in_plan_id.count loop

insert into quote.quote_plan(quote_id,plan_id,premium)
values(in_quote_id,in_plan_id(i),in_premium(i));

  end loop;

  commit;

end add_plan;

 

end MANAGE_QUOTE;



[2006-05-24 18:00:28] [EMAIL PROTECTED]

I don't think I have a quote.manage_quote.add_plan() procedure, so your
reproduce case is not very useful. 



[2006-05-24 17:51:13] jlevy at imerica dot com

Another developer in my office verified this bug is also present in PHP
5.1.4

Thank you.



[2006-05-24 17:49:50] jlevy at imerica dot com

Apologies for bad pastebin URL. Strip the excess http:// and it should
load properly.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/37581

-- 
Edit this bug report at http://bugs.php.net/?id=37581edit=1