#40184 [NEW]: Memory leak in SimpleXML ?

2007-01-21 Thread florence at post dot harvard dot edu
From: florence at post dot harvard dot edu
Operating system: Win XP
PHP version:  5.2.0
PHP Bug Type: SimpleXML related
Bug description:  Memory leak in SimpleXML ? 

Description:

Configure Command = cscript /nologo configure.js 
--enable-snapshot-build --with-gd=shared
Using php.ini-recommended
-
I am trying to parse about 4,000 xml files (each about 100-900KB in size).
The script I am using simplexml_load_file(). I get an out of memory error
after about 800 files.

I found bug #38604 and ran the script from that report (I copied it below)
and quickly got the out of memory error.
Bug #38604 says This bug has been fixed in CVS.  Was this really fixed
or was the bug report just closed? If it was really fixed, is the fix in
5.2.0?

Reproduce code:
---
?php
  $xml = 'rootnode/node/root';
  $xmldata = simplexml_load_string($xml);
  while (true) {
$foo = $xmldata-node;
foreach ($foo as $node)
{
}
  }
?




Actual result:
--
G:\xphp test_bug38604.php
PHP Fatal error:  Out of memory (allocated 839122944) (tried to allocate
2013265
92 bytes) in G:\x\test_bug38604.php on line 8

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


#40184 [Opn-Fbk]: Memory leak in SimpleXML ?

2007-01-21 Thread nlopess
 ID:   40184
 Updated by:   [EMAIL PROTECTED]
 Reported By:  florence at post dot harvard dot edu
-Status:   Open
+Status:   Feedback
 Bug Type: SimpleXML related
 Operating System: Win XP
 PHP Version:  5.2.0
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip




Previous Comments:


[2007-01-21 08:12:38] florence at post dot harvard dot edu

Description:

Configure Command = cscript /nologo configure.js 
--enable-snapshot-build --with-gd=shared
Using php.ini-recommended
-
I am trying to parse about 4,000 xml files (each about 100-900KB in
size). The script I am using simplexml_load_file(). I get an out of
memory error after about 800 files.

I found bug #38604 and ran the script from that report (I copied it
below) and quickly got the out of memory error.
Bug #38604 says This bug has been fixed in CVS.  Was this really
fixed or was the bug report just closed? If it was really fixed, is the
fix in 5.2.0?

Reproduce code:
---
?php
  $xml = 'rootnode/node/root';
  $xmldata = simplexml_load_string($xml);
  while (true) {
$foo = $xmldata-node;
foreach ($foo as $node)
{
}
  }
?




Actual result:
--
G:\xphp test_bug38604.php
PHP Fatal error:  Out of memory (allocated 839122944) (tried to
allocate 2013265
92 bytes) in G:\x\test_bug38604.php on line 8





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


#40185 [NEW]: PHP Crashes with a SegFault trying to zend_execute() some simple PHP scripts

2007-01-21 Thread darkwinter at tiscali dot es
From: darkwinter at tiscali dot es
Operating system: Linux - Ubuntu Dapper 6.06 LTS
PHP version:  5.2.0
PHP Bug Type: Reproducible crash
Bug description:  PHP Crashes with a SegFault trying to zend_execute() some 
simple PHP scripts

Description:

Let's see... I'm trying to write an extension module for PHP (shared
extension, ie: myext.so) that compiles and executes some PHP code that I
will pass to it.

Extension is working already but crashes on zend_execute() call depending
on what PHP code I give to it.

Trying to pin down the problem, I've found that it crashes trying to
execute ANY code that declares a variable (ie $a=1;) BEFORE any function
declaration. Weird.

I can reproduce the crash (Segmentation Fault (11) in Apache error.log)
anytime. See the Reproduce Code for tips. 

Also, I could fix the problem in lab somewhat: I have to create and call
a function (even a dummy one works) BEFORE the first variable use, ON EVERY
PHP CODE SNIPPET/SCRIPT I want to use, which will (might?) overflow the
global function table over time (I guess :m), as every function have to
have different names (so I don't try to redeclare a function twice,
AFAIK). 

As you can see, this is not a long term soluction I guess... :( but it
works for testing and may give you a clue to what's going on. 

Tested with the Following Env.

Ubuntu Dapper 6.06 LTS (Linux)
Apache 2.2.3
PHP 5.2.0
- myext.so



Reproduce code:
---
--- PHP CODE ---
?php
  $a=1;
?
--- END OF PHP CODE 


--- EXTENSION CODE THAT I'M TRYING TO USE: ---
myext.so

/* FAULTY CODE */

char faulty_code[] = echo 'Hi allbr';??php $a = 5; echo $a;
?;// this code crashes.

char faulty_code2[] = ??php $a = 5; echo $a; ?;
// this code
crashes.

char working_code[] = function foo() {}; foo(); echo 'Hi
allbr';??php $a = 5; echo $a; ?;  // this code works. Prepending a
function declaration AND a function call works (¿?)...

zend_op_array *op_array = NULL;
zval *new_string;

char *buf = (char *)emalloc(20 * 1024); // have plenty of space 
for this
test.
strcpy(buf, faulty_code);   // replace faulty_code with 
working_code to
see the difference.

MAKE_STD_ZVAL(new_string);
ZVAL_STRING(new_string, buf, 0);

op_array = zend_compile_string(new_string, test);

if (op_array != NULL)
{
zend_execute(op_array); // this crashes.
}

/* END OF FAULTY CODE */
--- END OF EXTENSION CODE THAT I'M TRYING TO USE: ---


Expected result:

It is expected for the PHP code to be executed: faulty_code[] arrays
contain valid PHP code and should execute, not give a segfault.

char faulty_code[] = echo 'Hi allbr';??php $a = 5; echo $a; ?;   
//
this code crashes.



Actual result:
--
faulty_code[] crashes with a SegFault #11 in apache logs.
working_code[] fix works flawless but need to create a function on every
snippet of code.

Of course, that would be a different problem and requires different names
each time, but that is not the real problem here.

// this code crashes and should work. Works in php -r
char faulty_code2[] = ??php $a = 5; echo $a; ?;

Note that i *require* to close and open PHP tags as I might have in
between some HTML code, for example:

// this code crashes and should work. Works in php -r
char faulty_code3[] = ?centerHello World from HTML/center?php $a =
5; echo $a; ?;

In few words:

A. Trying to execute faulty_code[] below from my PHP extension (or loading
the PHP CODE snippet (without the --- PHP CODE  lines)  from a .php
file crashes on zend_execute()

B. Trying to execute working_code[] or adding a function foo() {}; foo();
line before the line $a = 1 in the PHP CODE script works too.

C. Might be useful to know, so I remark it: I've tried also to execute
this code trough the PHP CLI successfully:

# php -r $a = 1; echo $a;

and it works.

Even with tags leave on it:

# php -r ?? $a = 1; echo $a; ?

also works.

Hope all of this helps. Please contact me for any issue you might have.
Thank you.


-- 
Edit bug report at http://bugs.php.net/?id=40185edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40185r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40185r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40185r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40185r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=40185r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=40185r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=40185r=needscript
Try newer version:http://bugs.php.net/fix.php?id=40185r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=40185r=support
Expected 

#40185 [Opn]: PHP Crashes with a SegFault trying to zend_execute() some simple PHP scripts

2007-01-21 Thread johannes
 ID:   40185
 Updated by:   [EMAIL PROTECTED]
 Reported By:  darkwinter at tiscali dot es
 Status:   Open
 Bug Type: Reproducible crash
 Operating System: Linux - Ubuntu Dapper 6.06 LTS
 PHP Version:  5.2.0
 New Comment:

This is no forum for questions about API usage, if you need help
contact pecl-dev (or internals) mailing list. I didn't check your code
in detail but I guess you missed to initialized some variables.
Therefore you should use zend_eval_string() instead of calling
zend_compile_string() and zend_execute() directly. For any further help
one would also need a backtrace...


Previous Comments:


[2007-01-21 11:10:19] darkwinter at tiscali dot es

Description:

Let's see... I'm trying to write an extension module for PHP (shared
extension, ie: myext.so) that compiles and executes some PHP code that
I will pass to it.

Extension is working already but crashes on zend_execute() call
depending on what PHP code I give to it.

Trying to pin down the problem, I've found that it crashes trying to
execute ANY code that declares a variable (ie $a=1;) BEFORE any
function declaration. Weird.

I can reproduce the crash (Segmentation Fault (11) in Apache error.log)
anytime. See the Reproduce Code for tips. 

Also, I could fix the problem in lab somewhat: I have to create and
call a function (even a dummy one works) BEFORE the first variable use,
ON EVERY PHP CODE SNIPPET/SCRIPT I want to use, which will (might?)
overflow the global function table over time (I guess :m), as every
function have to have different names (so I don't try to redeclare a
function twice, AFAIK). 

As you can see, this is not a long term soluction I guess... :( but it
works for testing and may give you a clue to what's going on. 

Tested with the Following Env.

Ubuntu Dapper 6.06 LTS (Linux)
Apache 2.2.3
PHP 5.2.0
- myext.so



Reproduce code:
---
--- PHP CODE ---
?php
  $a=1;
?
--- END OF PHP CODE 


--- EXTENSION CODE THAT I'M TRYING TO USE: ---
myext.so

/* FAULTY CODE */

char faulty_code[] = echo 'Hi allbr';??php $a = 5; echo $a;
?;// this code crashes.

char faulty_code2[] = ??php $a = 5; echo $a; ?;
// this code
crashes.

char working_code[] = function foo() {}; foo(); echo 'Hi
allbr';??php $a = 5; echo $a; ?;  // this code works. Prepending a
function declaration AND a function call works (¿?)...

zend_op_array *op_array = NULL;
zval *new_string;

char *buf = (char *)emalloc(20 * 1024); // have plenty of space 
for
this test.
strcpy(buf, faulty_code);   // replace faulty_code with 
working_code to
see the difference.

MAKE_STD_ZVAL(new_string);
ZVAL_STRING(new_string, buf, 0);

op_array = zend_compile_string(new_string, test);

if (op_array != NULL)
{
zend_execute(op_array); // this crashes.
}

/* END OF FAULTY CODE */
--- END OF EXTENSION CODE THAT I'M TRYING TO USE: ---


Expected result:

It is expected for the PHP code to be executed: faulty_code[] arrays
contain valid PHP code and should execute, not give a segfault.

char faulty_code[] = echo 'Hi allbr';??php $a = 5; echo $a;
?;// this code crashes.



Actual result:
--
faulty_code[] crashes with a SegFault #11 in apache logs.
working_code[] fix works flawless but need to create a function on
every snippet of code.

Of course, that would be a different problem and requires different
names each time, but that is not the real problem here.

// this code crashes and should work. Works in php -r
char faulty_code2[] = ??php $a = 5; echo $a; ?;

Note that i *require* to close and open PHP tags as I might have in
between some HTML code, for example:

// this code crashes and should work. Works in php -r
char faulty_code3[] = ?centerHello World from HTML/center?php $a
= 5; echo $a; ?;

In few words:

A. Trying to execute faulty_code[] below from my PHP extension (or
loading the PHP CODE snippet (without the --- PHP CODE  lines) 
from a .php file crashes on zend_execute()

B. Trying to execute working_code[] or adding a function foo() {};
foo(); line before the line $a = 1 in the PHP CODE script works too.

C. Might be useful to know, so I remark it: I've tried also to execute
this code trough the PHP CLI successfully:

# php -r $a = 1; echo $a;

and it works.

Even with tags leave on it:

# php -r ?? $a = 1; echo $a; ?

also works.

Hope all of this helps. Please contact me for any issue you might have.
Thank you.






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


#40185 [Opn-Bgs]: PHP Crashes with a SegFault trying to zend_execute() some simple PHP scripts

2007-01-21 Thread johannes
 ID:   40185
 Updated by:   [EMAIL PROTECTED]
 Reported By:  darkwinter at tiscali dot es
-Status:   Open
+Status:   Bogus
 Bug Type: Reproducible crash
 Operating System: Linux - Ubuntu Dapper 6.06 LTS
 PHP Version:  5.2.0
 New Comment:

.


Previous Comments:


[2007-01-21 12:13:16] [EMAIL PROTECTED]

This is no forum for questions about API usage, if you need help
contact pecl-dev (or internals) mailing list. I didn't check your code
in detail but I guess you missed to initialized some variables.
Therefore you should use zend_eval_string() instead of calling
zend_compile_string() and zend_execute() directly. For any further help
one would also need a backtrace...



[2007-01-21 11:10:19] darkwinter at tiscali dot es

Description:

Let's see... I'm trying to write an extension module for PHP (shared
extension, ie: myext.so) that compiles and executes some PHP code that
I will pass to it.

Extension is working already but crashes on zend_execute() call
depending on what PHP code I give to it.

Trying to pin down the problem, I've found that it crashes trying to
execute ANY code that declares a variable (ie $a=1;) BEFORE any
function declaration. Weird.

I can reproduce the crash (Segmentation Fault (11) in Apache error.log)
anytime. See the Reproduce Code for tips. 

Also, I could fix the problem in lab somewhat: I have to create and
call a function (even a dummy one works) BEFORE the first variable use,
ON EVERY PHP CODE SNIPPET/SCRIPT I want to use, which will (might?)
overflow the global function table over time (I guess :m), as every
function have to have different names (so I don't try to redeclare a
function twice, AFAIK). 

As you can see, this is not a long term soluction I guess... :( but it
works for testing and may give you a clue to what's going on. 

Tested with the Following Env.

Ubuntu Dapper 6.06 LTS (Linux)
Apache 2.2.3
PHP 5.2.0
- myext.so



Reproduce code:
---
--- PHP CODE ---
?php
  $a=1;
?
--- END OF PHP CODE 


--- EXTENSION CODE THAT I'M TRYING TO USE: ---
myext.so

/* FAULTY CODE */

char faulty_code[] = echo 'Hi allbr';??php $a = 5; echo $a;
?;// this code crashes.

char faulty_code2[] = ??php $a = 5; echo $a; ?;
// this code
crashes.

char working_code[] = function foo() {}; foo(); echo 'Hi
allbr';??php $a = 5; echo $a; ?;  // this code works. Prepending a
function declaration AND a function call works (¿?)...

zend_op_array *op_array = NULL;
zval *new_string;

char *buf = (char *)emalloc(20 * 1024); // have plenty of space 
for
this test.
strcpy(buf, faulty_code);   // replace faulty_code with 
working_code to
see the difference.

MAKE_STD_ZVAL(new_string);
ZVAL_STRING(new_string, buf, 0);

op_array = zend_compile_string(new_string, test);

if (op_array != NULL)
{
zend_execute(op_array); // this crashes.
}

/* END OF FAULTY CODE */
--- END OF EXTENSION CODE THAT I'M TRYING TO USE: ---


Expected result:

It is expected for the PHP code to be executed: faulty_code[] arrays
contain valid PHP code and should execute, not give a segfault.

char faulty_code[] = echo 'Hi allbr';??php $a = 5; echo $a;
?;// this code crashes.



Actual result:
--
faulty_code[] crashes with a SegFault #11 in apache logs.
working_code[] fix works flawless but need to create a function on
every snippet of code.

Of course, that would be a different problem and requires different
names each time, but that is not the real problem here.

// this code crashes and should work. Works in php -r
char faulty_code2[] = ??php $a = 5; echo $a; ?;

Note that i *require* to close and open PHP tags as I might have in
between some HTML code, for example:

// this code crashes and should work. Works in php -r
char faulty_code3[] = ?centerHello World from HTML/center?php $a
= 5; echo $a; ?;

In few words:

A. Trying to execute faulty_code[] below from my PHP extension (or
loading the PHP CODE snippet (without the --- PHP CODE  lines) 
from a .php file crashes on zend_execute()

B. Trying to execute working_code[] or adding a function foo() {};
foo(); line before the line $a = 1 in the PHP CODE script works too.

C. Might be useful to know, so I remark it: I've tried also to execute
this code trough the PHP CLI successfully:

# php -r $a = 1; echo $a;

and it works.

Even with tags leave on it:

# php -r ?? $a = 1; echo $a; ?

also works.

Hope all of this helps. Please contact me for any issue you might have.
Thank you.






-- 
Edit this bug report at 

#40186 [NEW]: ORA-00932: inconsistent datatypes: expected CHAR got ARRAY

2007-01-21 Thread tony at marston-home dot demon dot co dot uk
From: tony at marston-home dot demon dot co dot uk
Operating system: Windows XP
PHP version:  5.2.0
PHP Bug Type: OCI8 related
Bug description:  ORA-00932: inconsistent datatypes: expected CHAR got ARRAY

Description:

I am using the latest OCI8 extension from PECL.

I have created a database table which contains a VARRAY user-defined type
as follows:

CREATE OR REPLACE TYPE t_fav_food IS VARRAY(10) OF NUMBER(2);
CREATE TABLE x_person (
  person_id varchar2(8) NOT NULL,
  first_name varchar2(20) NOT NULL,
  last_name varchar2(30) NOT NULL,
  favourite_food t_fav_food,
  PRIMARY KEY  (person_id)
);

I can write a record containing a VARRAY type, but I am unable to read it
as oci_fetch_array() fails with error ORA-00932.




Reproduce code:
---
?php
$dbconn = ociLogon('tony', 'tony', '//localhost/xe') or die('unable to
connect to database');
$query = TRUNCATE TABLE x_person;
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('truncate
failed');
$query = INSERT INTO x_person (person_id, first_name, last_name,
favourite_food) VALUES ('AJM','Tony','Marston', t_fav_food(1,3,5));
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('insert #1
failed');
$query = INSERT INTO x_person (person_id, first_name, last_name,
favourite_food) VALUES ('FB','Fred','Bloggs', t_fav_food(2,4,6));
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('insert #2
failed');
$query = SELECT * FROM x_person;
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt) or die('select failed');
while ($row = @oci_fetch_array ($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
$array[] = array_change_key_case($row, CASE_LOWER);
} // while
if ($error_array = oci_error($stmt)) {
echo 'Error code: ' .$error_array['code'] .\r\n;
echo 'Error msg : ' .$error_array['message'] .\r\n;
exit();
} // if
echo 'Done';
?


Expected result:

I expect the VARRAY column to be made available in my program so that it
can be processed using the oci-collection methods, similar to the way
CLOBs and BLOBs are handled.

This is what I can already do with the SET type in MySQL, and the ARRAY
type in PostgreSQL.

Actual result:
--
The call to oci_fetch_array() fails with ORA-00932: inconsistent
datatypes: expected CHAR got ARRAY. This means that I am unable to read
table that contains a VARRAY column.

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


#40183 [Opn-Bgs]: fopen() for appending does not move position until first I/O

2007-01-21 Thread iliaa
 ID:   40183
 Updated by:   [EMAIL PROTECTED]
 Reported By:  perrog at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Filesystem function related
 Operating System: Mac OS X 10.4
 PHP Version:  5.2.1RC3
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The initial position returned is 0 because counting starts 
from the append position (earlier data does not count).


Previous Comments:


[2007-01-21 07:26:48] perrog at gmail dot com

Description:

Opening a file for appending does not move the file pointer to 
the end of file before the first I/O operation is performed.

That makes ftell() return zero directly after the fopen() 
call.

The workaround, if you need to call ftell() immediately after 
the fopen(), is to use a no-operation I/O call fseek() that 
don't do anything. Thus, the file pointer is updated and 
returns correct position information.

Reproduce code:
---
// create or open a file, and write some stuff to it.
$filename = /path/to/file.txt;
$fp = fopen($filename, a+);
fwrite($fp, Sample text);
fclose($fp);

// re-open it and check what ftell() returns
$fp = fopen($filename, a+);
echo  pre-fseek:  . ftell($fp) . \n; // ftell returns 0
fseek($fp, 0, SEEK_END);
echo post-fseek:  . ftell($fp) . \n; // ftell now ok


Expected result:

The snippet should print the file size of the file:

 pre-fseek: 11
post-fseek: 11

Actual result:
--
The snippet should print the correct file size only after the 
first I/O operation:

 pre-fseek: 0
post-fseek: 11





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


#40187 [NEW]: mt_rand(), rand()

2007-01-21 Thread callawey at gmail dot com
From: callawey at gmail dot com
Operating system: windows xp
PHP version:  5.2.0
PHP Bug Type: Math related
Bug description:  mt_rand(), rand()

Description:

rand and mt_rand generates random lenght integer between -99 and
+99. 

example mt_rand(1000, );
outputs: -564, -688852, 558988, -68889558

Reproduce code:
---
$str = mt_rand(1000, );

Expected result:

positive numbers between 1000 and 

Actual result:
--
-492911349,1162038978,-219333642

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


#40187 [Opn-Bgs]: mt_rand(), rand()

2007-01-21 Thread iliaa
 ID:   40187
 Updated by:   [EMAIL PROTECTED]
 Reported By:  callawey at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Math related
 Operating System: windows xp
 PHP Version:  5.2.0
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Integer overflow on 32 bit systems is the cause.


Previous Comments:


[2007-01-21 19:06:47] callawey at gmail dot com

Description:

rand and mt_rand generates random lenght integer between -99
and +99. 

example mt_rand(1000, );
outputs: -564, -688852, 558988, -68889558

Reproduce code:
---
$str = mt_rand(1000, );

Expected result:

positive numbers between 1000 and 

Actual result:
--
-492911349,1162038978,-219333642





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


#40186 [Opn-Asn]: ORA-00932: inconsistent datatypes: expected CHAR got ARRAY

2007-01-21 Thread iliaa
 ID:   40186
 Updated by:   [EMAIL PROTECTED]
 Reported By:  tony at marston-home dot demon dot co dot uk
-Status:   Open
+Status:   Assigned
 Bug Type: OCI8 related
 Operating System: Windows XP
 PHP Version:  5.2.0
-Assigned To:  
+Assigned To:  tony2001


Previous Comments:


[2007-01-21 13:51:22] tony at marston-home dot demon dot co dot uk

Description:

I am using the latest OCI8 extension from PECL.

I have created a database table which contains a VARRAY user-defined
type as follows:

CREATE OR REPLACE TYPE t_fav_food IS VARRAY(10) OF NUMBER(2);
CREATE TABLE x_person (
  person_id varchar2(8) NOT NULL,
  first_name varchar2(20) NOT NULL,
  last_name varchar2(30) NOT NULL,
  favourite_food t_fav_food,
  PRIMARY KEY  (person_id)
);

I can write a record containing a VARRAY type, but I am unable to read
it as oci_fetch_array() fails with error ORA-00932.




Reproduce code:
---
?php
$dbconn = ociLogon('tony', 'tony', '//localhost/xe') or die('unable to
connect to database');
$query = TRUNCATE TABLE x_person;
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('truncate
failed');
$query = INSERT INTO x_person (person_id, first_name, last_name,
favourite_food) VALUES ('AJM','Tony','Marston', t_fav_food(1,3,5));
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('insert #1
failed');
$query = INSERT INTO x_person (person_id, first_name, last_name,
favourite_food) VALUES ('FB','Fred','Bloggs', t_fav_food(2,4,6));
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('insert #2
failed');
$query = SELECT * FROM x_person;
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt) or die('select failed');
while ($row = @oci_fetch_array ($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
$array[] = array_change_key_case($row, CASE_LOWER);
} // while
if ($error_array = oci_error($stmt)) {
echo 'Error code: ' .$error_array['code'] .\r\n;
echo 'Error msg : ' .$error_array['message'] .\r\n;
exit();
} // if
echo 'Done';
?


Expected result:

I expect the VARRAY column to be made available in my program so that
it can be processed using the oci-collection methods, similar to the
way CLOBs and BLOBs are handled.

This is what I can already do with the SET type in MySQL, and the ARRAY
type in PostgreSQL.

Actual result:
--
The call to oci_fetch_array() fails with ORA-00932: inconsistent
datatypes: expected CHAR got ARRAY. This means that I am unable to read
table that contains a VARRAY column.





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


#40187 [Bgs]: mt_rand(), rand()

2007-01-21 Thread callawey at gmail dot com
 ID:   40187
 User updated by:  callawey at gmail dot com
 Reported By:  callawey at gmail dot com
 Status:   Bogus
 Bug Type: Math related
 Operating System: windows xp
 PHP Version:  5.2.0
 New Comment:

while($row = $DB-fetchArray($result))
{
for($i=0;$i=12;$i++)
{
$str .= rand(0,9);
}
//$str = mt_rand(1000, );  

$sqlc = sprintf(UPDATE %s SET user_id='%s' WHERE 
id='%s',
$DB-prefix(users), $str, $row[id]);
$DB-queryF($sqlc);
}



this code makes all colums -1


Previous Comments:


[2007-01-21 19:10:58] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Integer overflow on 32 bit systems is the cause.



[2007-01-21 19:06:47] callawey at gmail dot com

Description:

rand and mt_rand generates random lenght integer between -99
and +99. 

example mt_rand(1000, );
outputs: -564, -688852, 558988, -68889558

Reproduce code:
---
$str = mt_rand(1000, );

Expected result:

positive numbers between 1000 and 

Actual result:
--
-492911349,1162038978,-219333642





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


#40187 [Bgs]: mt_rand(), rand()

2007-01-21 Thread callawey at gmail dot com
 ID:   40187
 User updated by:  callawey at gmail dot com
 Reported By:  callawey at gmail dot com
 Status:   Bogus
 Bug Type: Math related
 Operating System: windows xp
 PHP Version:  5.2.0
 New Comment:

while($row = $DB-fetchArray($result))
{
$str = ;
for($i=0;$i=12;$i++)
{
$str .= rand(0,9);
}

$sqlc = sprintf(UPDATE %s SET user_id='%s' WHERE 
id='%s',
$DB-prefix(users), $str, $row[id]);
$DB-queryF($sqlc);
}

this returns same number everytime even i use $str = ; in every loop
Why ?


Previous Comments:


[2007-01-21 19:12:02] callawey at gmail dot com

while($row = $DB-fetchArray($result))
{
for($i=0;$i=12;$i++)
{
$str .= rand(0,9);
}
//$str = mt_rand(1000, );  

$sqlc = sprintf(UPDATE %s SET user_id='%s' WHERE 
id='%s',
$DB-prefix(users), $str, $row[id]);
$DB-queryF($sqlc);
}



this code makes all colums -1



[2007-01-21 19:10:58] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Integer overflow on 32 bit systems is the cause.



[2007-01-21 19:06:47] callawey at gmail dot com

Description:

rand and mt_rand generates random lenght integer between -99
and +99. 

example mt_rand(1000, );
outputs: -564, -688852, 558988, -68889558

Reproduce code:
---
$str = mt_rand(1000, );

Expected result:

positive numbers between 1000 and 

Actual result:
--
-492911349,1162038978,-219333642





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


#39892 [Opn-Bgs]: fetch_fields / fetch_field_direct

2007-01-21 Thread iliaa
 ID:   39892
 Updated by:   [EMAIL PROTECTED]
 Reported By:  migues at email dot cz
-Status:   Open
+Status:   Bogus
 Bug Type: MySQLi related
 Operating System: Win XP Pro SP2
 PHP Version:  5.2.0
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The problem here is that the mysql mysql_fetch_field_direct() 
function fails to populate the def property of the 
MYSQL_FIELD structure. This subsequently causes PHP to put an 
empty string for its value.


Previous Comments:


[2007-01-18 08:01:45] migues at email dot cz

Thanks to Christian and his example code, status can be changed to open
again.



[2007-01-17 21:43:06] ceabear at gmx dot de

Here is a quick example code for the original bug report,
it should print the column name and its defined default value for the
column.

?php
$sql=CREATE TABLE `fetchfield` (
  `id` int(11) NOT NULL auto_increment,
  `product` varchar(11) collate latin1_german1_ci NOT NULL default
'standard',
  `test` int(11) default '3',
  `nullable` int(11) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;;

$con=mysqli_connect('localhost','username','password','test');
mysqli_query($con,$sql);

$res=mysqli_query($con,SELECT * FROM test.fetchfield);
$metas=mysqli_fetch_fields($res);
foreach($metas as $meta)
{
echo 'default for '.$meta-name.' is:';
var_dump($meta-def);
echo 'br';
}
?

this creates a simple test table with some fields, which get default
values by definition.

as a result I get:
default for id is:string(0) 
default for product is:string(0) 
default for test is:string(0) 
default for nullable is:string(0) 

the column names are printed ($meta-name) but the default value
($meta-def) is always an empty string.

expected output is:
default for id is:string(0) 
default for product is:string(0) standard
default for test is:string(0) 3
default for nullable is:string(0) null

it looks like the default value is always an empty string instead of
data out of the database.

looking into the source of php, a null value would be never returned
(because of the source code).

I tried to find out, if this could be a problem of the c-api of mysql,
but didn't find a fitting bug entry on mysql.

maybe this helps to understand the problem?

I used mysql version 5.0.21-community-nt-log on Windows 2000 SP4 and
PHP 5.2.0 for testing



[2006-12-27 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to Open.



[2006-12-19 22:21:26] [EMAIL PROTECTED]

It might become really simple as soon as I get what you're talking
about.
At the moment I don't get it, sorry.



[2006-12-19 21:56:49] migues at email dot cz

Hey guys!

Sorry I'm quite novice so it would took me long time to reproduce step
by step creation a.s.o.

But it's simple :
def $res-fetch_fields(); in returns always null! I guess it will work
always the same on other mysql 5.0... with mysqli_result object



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/39892

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


#36797 [Opn-Asn]: Problem using UTF-8 database with pdo_oci

2007-01-21 Thread iliaa
 ID:   36797
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mauroi at digbang dot com
-Status:   Open
+Status:   Assigned
 Bug Type: PDO related
 Operating System: Win XP SP2
 PHP Version:  5.1.2
-Assigned To:  
+Assigned To:  wez


Previous Comments:


[2006-03-20 15:29:43] mauroi at digbang dot com

I've tried but the same happens.
I've also tried the complete NLS_LANG (AMERICAN_AMERICA.AL32UTF8) with
no success.

Thanks!



[2006-03-20 15:25:04] [EMAIL PROTECTED]

Try with AL32UTF8 instead of UTF-8.



[2006-03-20 15:22:13] mauroi at digbang dot com

Description:

I'm trying to use a AL32UTF8 database with PDO, but it seems that the
charset is not correctly set (I get funny characters in the output).
I've tried the method described in
(http://www.oracle.com/technology/pub/articles/php_experts/otn_pdo_oracle5.html)
with no success.
I'm using Oracle instant client for Windows.

Reproduce code:
---
sql:

create table foo (field varchar(10));

php:

$a = new PDO('oci:dbname=server;charset=UTF-8', 'user', 'password');

$a-beginTransaction();

$b = $a-prepare('insert into foo (field) values (?)');
$b-bindValue(1, 'áéíóú');
$b-execute();

$c = $a-prepare('select * from foo');
$c-execute();
var_dump($c-fetchAll());

$a-rollBack();

Expected result:

the result with the row with áéíóú correctly displayed






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


#36974 [Opn-Asn]: ORA-01405: fetched column value is NULL on LOB fields in 10g

2007-01-21 Thread iliaa
 ID:   36974
 Updated by:   [EMAIL PROTECTED]
 Reported By:  crescentfreshpot at yahoo dot com
-Status:   Open
+Status:   Assigned
 Bug Type: PDO related
 Operating System: Win 2000, Win XP
 PHP Version:  5.1.2
-Assigned To:  
+Assigned To:  wez


Previous Comments:


[2006-07-31 18:20:48] crescentfreshpot at yahoo dot com

Same warning with PHP 5.2.0RC2-dev (cli) (built: Jul 31 2006 16:21:10)



[2006-06-28 01:00:01] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to Open.



[2006-06-20 15:19:13] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip





[2006-04-05 13:48:26] crescentfreshpot at yahoo dot com

Happens on Oracle 9i as well (win xp, php 5.1.2).



[2006-04-04 20:45:47] crescentfreshpot at yahoo dot com

Description:

pdo_oci does not convert oracle nulls to php nulls when fetching from
lob fields. Appears in 5.0.5 to 5.1.2 versions of php/pdo/pdo_oci.
Oracle version is 10g. Non-lob fields appear to convert just fine.

Setting the PDO::ATTR_ORACLE_NULLS driver attribute to
PDO::NULL_TO_STRING and/or PDO::NULL_EMPTY_STRING has no effect.

I'm aware that this behaviour is 'by design' for oracle but was led to
believe by the docs that pdo handled nulls for me so I don't have to
resort to using NVL(...) in my queries.

Reproduce code:
---
?php

error_reporting(E_ALL);
$dbh = new PDO('oci:', 'scott', 'tiger');
$dbh-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);

var_dump($dbh-query(SELECT * FROM
SCOTT.EMP)-fetch(PDO::FETCH_ASSOC));

if($dbh-exec(ALTER TABLE SCOTT.EMP ADD (PIC BLOB)) === false) {
  die(ALTER TABLE failed.);
}

var_dump($dbh-query(SELECT * FROM
SCOTT.EMP)-fetch(PDO::FETCH_ASSOC));

$dbh-exec(ALTER TABLE SCOTT.EMP DROP (PIC));

?

Expected result:

array(8) {
  [EMPNO]=
  string(4) 7369
  [ENAME]=
  string(5) SMITH
  [JOB]=
  string(5) CLERK
  [MGR]=
  string(4) 7902
  [HIREDATE]=
  string(9) 17-DEC-80
  [SAL]=
  string(3) 800
  [COMM]=
  NULL
  [DEPTNO]=
  string(2) 20
}
array(8) {
  [EMPNO]=
  string(4) 7369
  [ENAME]=
  string(5) SMITH
  [JOB]=
  string(5) CLERK
  [MGR]=
  string(4) 7902
  [HIREDATE]=
  string(9) 17-DEC-80
  [SAL]=
  string(3) 800
  [COMM]=
  NULL
  [DEPTNO]=
  string(2) 20
  [PIC]=
  NULL
}

Actual result:
--
array(8) {
  [EMPNO]=
  string(4) 7369
  [ENAME]=
  string(5) SMITH
  [JOB]=
  string(5) CLERK
  [MGR]=
  string(4) 7902
  [HIREDATE]=
  string(9) 17-DEC-80
  [SAL]=
  string(3) 800
  [COMM]=
  NULL
  [DEPTNO]=
  string(2) 20
}
br /
bWarning/b:  PDOStatement::fetch() [a
href='function.fetch'function.fetch/a]: SQLSTATE[HY000]: General
error: 1405 OCIStmtFetch: ORA-01405: fetched column value is NULL
 (..\pecl_5_0\pdo_oci\oci_statement.c:446) in
bC:\dev\tests\db.php/b on line b13/bbr /
bool(false)





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


#40185 [Bgs]: PHP Crashes with a SegFault trying to zend_execute() some simple PHP scripts

2007-01-21 Thread darkwinter at tiscali dot es
 ID:   40185
 User updated by:  darkwinter at tiscali dot es
 Reported By:  darkwinter at tiscali dot es
 Status:   Bogus
 Bug Type: Reproducible crash
 Operating System: Linux - Ubuntu Dapper 6.06 LTS
 PHP Version:  5.2.0
 New Comment:

Thank you for your quick reply.

I will report this issue to pecl or internals mailing list and see what
they tell me. Will leave this open for now just in case they ask me to
continue here.

About the backtrace, I've tried to compile PHP 5.2.0 with debugging
information, and also Latest CVS (as of 21-Jan-07) with no success.
Sorry, but I keep getting compilation errors so I can't put the debug
apache2 module and therefore can't get a core dump and a back trace. 

I've tried it but I guess I have not enough knowledge to do it without
further help.


Previous Comments:


[2007-01-21 12:13:40] [EMAIL PROTECTED]

.



[2007-01-21 12:13:16] [EMAIL PROTECTED]

This is no forum for questions about API usage, if you need help
contact pecl-dev (or internals) mailing list. I didn't check your code
in detail but I guess you missed to initialized some variables.
Therefore you should use zend_eval_string() instead of calling
zend_compile_string() and zend_execute() directly. For any further help
one would also need a backtrace...



[2007-01-21 11:10:19] darkwinter at tiscali dot es

Description:

Let's see... I'm trying to write an extension module for PHP (shared
extension, ie: myext.so) that compiles and executes some PHP code that
I will pass to it.

Extension is working already but crashes on zend_execute() call
depending on what PHP code I give to it.

Trying to pin down the problem, I've found that it crashes trying to
execute ANY code that declares a variable (ie $a=1;) BEFORE any
function declaration. Weird.

I can reproduce the crash (Segmentation Fault (11) in Apache error.log)
anytime. See the Reproduce Code for tips. 

Also, I could fix the problem in lab somewhat: I have to create and
call a function (even a dummy one works) BEFORE the first variable use,
ON EVERY PHP CODE SNIPPET/SCRIPT I want to use, which will (might?)
overflow the global function table over time (I guess :m), as every
function have to have different names (so I don't try to redeclare a
function twice, AFAIK). 

As you can see, this is not a long term soluction I guess... :( but it
works for testing and may give you a clue to what's going on. 

Tested with the Following Env.

Ubuntu Dapper 6.06 LTS (Linux)
Apache 2.2.3
PHP 5.2.0
- myext.so



Reproduce code:
---
--- PHP CODE ---
?php
  $a=1;
?
--- END OF PHP CODE 


--- EXTENSION CODE THAT I'M TRYING TO USE: ---
myext.so

/* FAULTY CODE */

char faulty_code[] = echo 'Hi allbr';??php $a = 5; echo $a;
?;// this code crashes.

char faulty_code2[] = ??php $a = 5; echo $a; ?;
// this code
crashes.

char working_code[] = function foo() {}; foo(); echo 'Hi
allbr';??php $a = 5; echo $a; ?;  // this code works. Prepending a
function declaration AND a function call works (¿?)...

zend_op_array *op_array = NULL;
zval *new_string;

char *buf = (char *)emalloc(20 * 1024); // have plenty of space 
for
this test.
strcpy(buf, faulty_code);   // replace faulty_code with 
working_code to
see the difference.

MAKE_STD_ZVAL(new_string);
ZVAL_STRING(new_string, buf, 0);

op_array = zend_compile_string(new_string, test);

if (op_array != NULL)
{
zend_execute(op_array); // this crashes.
}

/* END OF FAULTY CODE */
--- END OF EXTENSION CODE THAT I'M TRYING TO USE: ---


Expected result:

It is expected for the PHP code to be executed: faulty_code[] arrays
contain valid PHP code and should execute, not give a segfault.

char faulty_code[] = echo 'Hi allbr';??php $a = 5; echo $a;
?;// this code crashes.



Actual result:
--
faulty_code[] crashes with a SegFault #11 in apache logs.
working_code[] fix works flawless but need to create a function on
every snippet of code.

Of course, that would be a different problem and requires different
names each time, but that is not the real problem here.

// this code crashes and should work. Works in php -r
char faulty_code2[] = ??php $a = 5; echo $a; ?;

Note that i *require* to close and open PHP tags as I might have in
between some HTML code, for example:

// this code crashes and should work. Works in php -r
char faulty_code3[] = ?centerHello World from HTML/center?php $a
= 5; echo $a; ?;

In few words:

A. Trying to execute faulty_code[] below from my PHP extension (or
loading the PHP CODE snippet 

#40188 [NEW]: stream_copy_to_stream() with filters truncates output

2007-01-21 Thread [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Operating system: kubuntu linux
PHP version:  5.2.0
PHP Bug Type: Streams related
Bug description:  stream_copy_to_stream() with filters truncates output

Description:

This was detected in the phar extension, but can be reproduced with
regular php code.

Because _php_stream_read in main/streams/streams.c automatically truncates
output from a streams filter to the maximum requested amount, this does not
allow the possibility of specifying pre-filter amount of bytes to read.

new b is 5 bytes, but zlib deflates it to a 7-byte length.Because
writepos is  toread, it is cut to 5 bytes.

A new flag is needed to specify that we want to read a maximum bytes, not
write a maximum bytes.

Although I put int(7) in the expected output, I don't expect this output
unless a flag is passed that specifically asks to do this.

Reproduce code:
---
?php
file_put_contents('test1.txt', 'new b/next thing');
$a = fopen('test1.txt', 'rb');
$newa = fopen('test2.txt', 'wb');
stream_filter_append($a, 'zlib.deflate');
$b = stream_copy_to_stream($a, $newa, 5);
var_dump($b, ftell($newa));

Expected result:

int(5)
int(7)

Actual result:
--
int(5)
int(5)

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


#40189 [NEW]: endless loop in zlib.inflate stream filter

2007-01-21 Thread [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Operating system: kubuntu linux
PHP version:  5CVS-2007-01-22 (CVS)
PHP Bug Type: Zlib Related
Bug description:  endless loop in zlib.inflate stream filter

Description:

run the test pecl/phar/tests/phar_ctx_001.phpt or
pecl/phar/tests/phar_oo_compressed_001.phpt

and you will see an endless loop.  The loop happens in
ext/zlib/zlib_filter.c at line 83:

while (bin  bucket-buflen) {
desired = bucket-buflen - bin;
if (desired  data-inbuf_len) {
desired = data-inbuf_len;
}
memcpy(data-strm.next_in, bucket-buf + bin, desired);
data-strm.avail_in = desired;

status = inflate((data-strm), flags  
PSFS_FLAG_FLUSH_CLOSE ?
Z_FINISH : Z_SYNC_FLUSH);
if (status != Z_OK  status != Z_STREAM_END) {
/* Something bad happened */
php_stream_bucket_delref(bucket TSRMLS_CC);
return PSFS_ERR_FATAL;
}
desired -= data-strm.avail_in; /* desired becomes what 
we consumed
this round through */
data-strm.next_in = data-inbuf;
data-strm.avail_in = 0;
consumed += desired;
bin += desired;

if (data-strm.avail_out  data-outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data-outbuf_len - 
data-strm.avail_out;
out_bucket = php_stream_bucket_new(stream, 
estrndup(data-outbuf,
bucketlen), bucketlen, 1, 0 TSRMLS_CC);
php_stream_bucket_append(buckets_out, 
out_bucket TSRMLS_CC);
data-strm.avail_out = data-outbuf_len;
data-strm.next_out = data-outbuf;
exit_status = PSFS_PASS_ON;
}
}

the loop should exit when desired is set to 0, but doesn't.

The attached patch fixes this issue.

Reproduce code:
---
Index: ext/zlib/zlib_filter.c
===
RCS file: /repository/php-src/ext/zlib/zlib_filter.c,v
retrieving revision 1.6.2.2.2.3
diff -u -r1.6.2.2.2.3 zlib_filter.c
--- ext/zlib/zlib_filter.c  1 Jan 2007 09:36:10 -  
1.6.2.2.2.3
+++ ext/zlib/zlib_filter.c  22 Jan 2007 02:23:39 -
@@ -99,6 +99,10 @@
data-strm.avail_in = 0;
consumed += desired;
bin += desired;
+   if (!desired) {
+   flags |= PSFS_FLAG_FLUSH_CLOSE;
+   break;
+   }

if (data-strm.avail_out  data-outbuf_len) {
php_stream_bucket *out_bucket;



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


#40190 [NEW]: ?

2007-01-21 Thread vbazuke at hotmail dot com
From: vbazuke at hotmail dot com
Operating system: Win XP
PHP version:  5.2.0
PHP Bug Type: Output Control
Bug description:  ?

Description:

When using a variable inside a output.

Reproduce code:
---
echo INPUT TYPE=text name=something1[];
//It's Okay

$i=1;

echo INPUT TYPE=text name=something$i[];
//Return a parse error

Expected result:

A normal box named something1[].

Actual result:
--
Parse error: parse error, unexpected ']', expecting T_STRING or T_VARIABLE
or T_NUM_STRING in C:\AppServ\www\coritibafc\bolao\apostas.php on line 32

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


#40151 [Bgs-Opn]: fsockopen can not work?

2007-01-21 Thread playercd8 at hotmail dot com
 ID:   40151
 User updated by:  playercd8 at hotmail dot com
 Reported By:  playercd8 at hotmail dot com
-Status:   Bogus
+Status:   Open
 Bug Type: Network related
 Operating System: FreeBSD5.5
 PHP Version:  5.2.0
 New Comment:

Because, is PHP Version too new ?

use 
?php
phpinfo();
?

-
OS = FreeBSD 5.5
PHP Version 5.2.0

Configure Command=
'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php'
'--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local'
'--enable-reflection' '--enable-spl' '--program-prefix='
'--enable-fastcgi' '--with-apxs2=/usr/local/sbin/apxs'
'--with-regex=php' '--with-zend-vm=CALL' '--prefix=/usr/local'

PHP API = 20041225
PHP Extension   = 20060613
Zend Extension  = 220060519 

but, Sockets Support =  enabled ? why?

---
OS = Fedora Core 6
PHP Version 5.1.6

Configure Command =
'./configure' '--build=i386-redhat-linux' '--host=i386-redhat-linux'
'--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--cache-file=../config.cache'
'--with-libdir=lib' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic'
'--disable-rpath' '--without-pear' '--with-bz2' '--with-curl'
'--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr'
'--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm'
'--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr'
'--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU'
'--enable-exif' '--enable-ftp' '--enable-magic-quotes'
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm'
'--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid'
'--enable-yp' '--enable-wddx' '--with-kerberos'
'--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr'
'--enable-memory-limit' '--enable-shmop' '--enable-calendar'
'--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic'
'--without-sqlite' '--with-libxml-dir=/usr' '--with-xml'
'--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd'
'--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC'
'--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter'

PHP API = 20041225
PHP Extension   = 20050922
Zend Extension  = 220051025

Sockets Support = enabled


Previous Comments:


[2007-01-19 09:39:02] playercd8 at hotmail dot com

are your answer like PHP5 can not sure to use fsockopen at FreeBSD?

is fsockopen not support at FreeBSD, now?

or, you are remove PHP5 able use at FreeBSD?

It's Bug? or not bug?



[2007-01-19 08:07:53] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.





[2007-01-19 04:25:18] playercd8 at hotmail dot com

I can manual telnet remote WebServer to get a html-file at FreeBSD.

but, I can not use fsockopen at FreeBSD.

Why?



[2007-01-19 02:23:15] playercd8 at hotmail dot com

function HttpRequest, It can run at PHP of Fedora Core 6.
but, Why it can not run at FreeBSD ?

Source code of the function, from 
http://www.webdeveloper.com/forum/archive/index.php/t-117095.html
, and my some fix it.



PHP work at FreeBSD, It can use socket_connect/socket_recv/socket_write
...etc.
but, why It can not use fsockopen ?

Why ?
-

function HttpRequest( $url, $method = GET, $data = NULL,
$additional_headers = NULL, $followRedirects = true )

{

# in compliance with the RFC 2616 post data will not redirected

$method = strtoupper($method);

$url_parsed = @parse_url($url);

if ([EMAIL PROTECTED]'scheme']) $url_parsed =
@parse_url('http://'.$url);

extract($url_parsed);



$data_get = NULL;

if(is_array($data))

{

$ampersand = '';

$temp = NULL;


#40190 [Opn-Bgs]: ?

2007-01-21 Thread tony2001
 ID:   40190
 Updated by:   [EMAIL PROTECTED]
 Reported By:  vbazuke at hotmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Output Control
 Operating System: Win XP
 PHP Version:  5.2.0
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:


[2007-01-22 05:45:50] vbazuke at hotmail dot com

Description:

When using a variable inside a output.

Reproduce code:
---
echo INPUT TYPE=text name=something1[];
//It's Okay

$i=1;

echo INPUT TYPE=text name=something$i[];
//Return a parse error

Expected result:

A normal box named something1[].

Actual result:
--
Parse error: parse error, unexpected ']', expecting T_STRING or
T_VARIABLE or T_NUM_STRING in
C:\AppServ\www\coritibafc\bolao\apostas.php on line 32





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


#40151 [Opn-Bgs]: fsockopen can not work?

2007-01-21 Thread tony2001
 ID:   40151
 Updated by:   [EMAIL PROTECTED]
 Reported By:  playercd8 at hotmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Network related
 Operating System: FreeBSD5.5
 PHP Version:  5.2.0
 New Comment:

Most likely because of some kind of firewall.
Not PHP problem.


Previous Comments:


[2007-01-22 06:18:28] playercd8 at hotmail dot com

Because, is PHP Version too new ?

use 
?php
phpinfo();
?

-
OS = FreeBSD 5.5
PHP Version 5.2.0

Configure Command=
'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php'
'--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local'
'--enable-reflection' '--enable-spl' '--program-prefix='
'--enable-fastcgi' '--with-apxs2=/usr/local/sbin/apxs'
'--with-regex=php' '--with-zend-vm=CALL' '--prefix=/usr/local'

PHP API = 20041225
PHP Extension   = 20060613
Zend Extension  = 220060519 

but, Sockets Support =  enabled ? why?

---
OS = Fedora Core 6
PHP Version 5.1.6

Configure Command =
'./configure' '--build=i386-redhat-linux' '--host=i386-redhat-linux'
'--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--cache-file=../config.cache'
'--with-libdir=lib' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic'
'--disable-rpath' '--without-pear' '--with-bz2' '--with-curl'
'--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr'
'--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm'
'--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr'
'--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU'
'--enable-exif' '--enable-ftp' '--enable-magic-quotes'
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm'
'--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid'
'--enable-yp' '--enable-wddx' '--with-kerberos'
'--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr'
'--enable-memory-limit' '--enable-shmop' '--enable-calendar'
'--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic'
'--without-sqlite' '--with-libxml-dir=/usr' '--with-xml'
'--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd'
'--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC'
'--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter'

PHP API = 20041225
PHP Extension   = 20050922
Zend Extension  = 220051025

Sockets Support = enabled



[2007-01-19 09:39:02] playercd8 at hotmail dot com

are your answer like PHP5 can not sure to use fsockopen at FreeBSD?

is fsockopen not support at FreeBSD, now?

or, you are remove PHP5 able use at FreeBSD?

It's Bug? or not bug?



[2007-01-19 08:07:53] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.





[2007-01-19 04:25:18] playercd8 at hotmail dot com

I can manual telnet remote WebServer to get a html-file at FreeBSD.

but, I can not use fsockopen at FreeBSD.

Why?



[2007-01-19 02:23:15] playercd8 at hotmail dot com

function HttpRequest, It can run at PHP of Fedora Core 6.
but, Why it can not run at FreeBSD ?

Source code of the function, from 
http://www.webdeveloper.com/forum/archive/index.php/t-117095.html
, and my some fix it.



PHP work at FreeBSD, It can use socket_connect/socket_recv/socket_write
...etc.
but, why It can not use fsockopen ?

Why ?
-

function HttpRequest( $url, $method = GET, $data = NULL,
$additional_headers = NULL, $followRedirects = true )

{

# in compliance with the RFC 2616 post data will not redirected

$method = strtoupper($method);

$url_parsed = @parse_url($url);

if ([EMAIL PROTECTED]'scheme']) $url_parsed =
@parse_url('http://'.$url);

extract($url_parsed);


#40188 [Opn-Asn]: stream_copy_to_stream() with filters truncates output

2007-01-21 Thread tony2001
 ID:   40188
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Open
+Status:   Assigned
 Bug Type: Streams related
 Operating System: kubuntu linux
 PHP Version:  5.2.0
-Assigned To:  
+Assigned To:  pollita
 New Comment:

Sara, could you look into this?


Previous Comments:


[2007-01-21 22:07:56] [EMAIL PROTECTED]

Description:

This was detected in the phar extension, but can be reproduced with
regular php code.

Because _php_stream_read in main/streams/streams.c automatically
truncates output from a streams filter to the maximum requested amount,
this does not allow the possibility of specifying pre-filter amount of
bytes to read.

new b is 5 bytes, but zlib deflates it to a 7-byte length.Because
writepos is  toread, it is cut to 5 bytes.

A new flag is needed to specify that we want to read a maximum bytes,
not write a maximum bytes.

Although I put int(7) in the expected output, I don't expect this
output unless a flag is passed that specifically asks to do this.

Reproduce code:
---
?php
file_put_contents('test1.txt', 'new b/next thing');
$a = fopen('test1.txt', 'rb');
$newa = fopen('test2.txt', 'wb');
stream_filter_append($a, 'zlib.deflate');
$b = stream_copy_to_stream($a, $newa, 5);
var_dump($b, ftell($newa));

Expected result:

int(5)
int(7)

Actual result:
--
int(5)
int(5)





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


#40189 [Opn-Asn]: endless loop in zlib.inflate stream filter

2007-01-21 Thread tony2001
 ID:   40189
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Open
+Status:   Assigned
 Bug Type: Zlib Related
 Operating System: kubuntu linux
 PHP Version:  5CVS-2007-01-22 (CVS)
-Assigned To:  
+Assigned To:  pollita
 New Comment:

Sara, could you look into this?
Btw, I can see the very same code in ext/bz2.


Previous Comments:


[2007-01-22 02:25:51] [EMAIL PROTECTED]

Description:

run the test pecl/phar/tests/phar_ctx_001.phpt or
pecl/phar/tests/phar_oo_compressed_001.phpt

and you will see an endless loop.  The loop happens in
ext/zlib/zlib_filter.c at line 83:

while (bin  bucket-buflen) {
desired = bucket-buflen - bin;
if (desired  data-inbuf_len) {
desired = data-inbuf_len;
}
memcpy(data-strm.next_in, bucket-buf + bin, desired);
data-strm.avail_in = desired;

status = inflate((data-strm), flags  
PSFS_FLAG_FLUSH_CLOSE ?
Z_FINISH : Z_SYNC_FLUSH);
if (status != Z_OK  status != Z_STREAM_END) {
/* Something bad happened */
php_stream_bucket_delref(bucket TSRMLS_CC);
return PSFS_ERR_FATAL;
}
desired -= data-strm.avail_in; /* desired becomes what 
we consumed
this round through */
data-strm.next_in = data-inbuf;
data-strm.avail_in = 0;
consumed += desired;
bin += desired;

if (data-strm.avail_out  data-outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data-outbuf_len - 
data-strm.avail_out;
out_bucket = php_stream_bucket_new(stream, 
estrndup(data-outbuf,
bucketlen), bucketlen, 1, 0 TSRMLS_CC);
php_stream_bucket_append(buckets_out, 
out_bucket TSRMLS_CC);
data-strm.avail_out = data-outbuf_len;
data-strm.next_out = data-outbuf;
exit_status = PSFS_PASS_ON;
}
}

the loop should exit when desired is set to 0, but doesn't.

The attached patch fixes this issue.

Reproduce code:
---
Index: ext/zlib/zlib_filter.c
===
RCS file: /repository/php-src/ext/zlib/zlib_filter.c,v
retrieving revision 1.6.2.2.2.3
diff -u -r1.6.2.2.2.3 zlib_filter.c
--- ext/zlib/zlib_filter.c  1 Jan 2007 09:36:10 -  
1.6.2.2.2.3
+++ ext/zlib/zlib_filter.c  22 Jan 2007 02:23:39 -
@@ -99,6 +99,10 @@
data-strm.avail_in = 0;
consumed += desired;
bin += desired;
+   if (!desired) {
+   flags |= PSFS_FLAG_FLUSH_CLOSE;
+   break;
+   }

if (data-strm.avail_out  data-outbuf_len) {
php_stream_bucket *out_bucket;







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


#40139 [Opn-Fbk]: Mail command not returning true on success

2007-01-21 Thread tony2001
 ID:   40139
 Updated by:   [EMAIL PROTECTED]
 Reported By:  sab2002a at yahoo dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Mail related
 Operating System: FreeBSD 5.4
 PHP Version:  4.4.4
 New Comment:

We are still unable to reproduce it.


Previous Comments:


[2007-01-20 19:47:55] sab2002a at yahoo dot com

Still the same thing.

Here's the code:

?php
error_reporting(E_ALL);
ini_set(display_errors, 1);
if (!mail('[EMAIL PROTECTED]','test','test','From:
[EMAIL PROTECTED]'))
echo An error occurred;
else
echo no error occurred;
?

The mail gets delivered and I still get An error occurred as the
output with nothing else.

I'm thinking it may be something to do with the way I'm
configuring/compiling.

Here's my configure line:
./configure --with-openssl --enable-calendar --with-curl --with-gd
--with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir
--with-ttf --with-freetype-dir --with-t1lib --enable-gd-native-ttf
--with-gettext --with-gmp --with-iconv --with-mcal --with-mcrypt
--with-mhash --with-mime-magic --with-mysql --with-mysql-lib
--with-ncurses --enable-pcntl --with-jpeg-dir --with-png-dir
--with-zlib-dir --with-tiff-dir --with-pspell --with-mm
--enable-sysvsem --enable-sysvmsg --enable-sysvshm --with-xmlrpc
--with-iconv-dir --enable-xslt --with-xslt-sablot --with-iconv-dir
--with-pear --enable-zend-multibyte --enable-sockets --enable-pcntl
--enable-sigchild --enable-libgcc --enable-trans-sid --enable-ftp
--with-config-file-path=/usr/local/lib --prefix=/usr/local/php
--with-config-file-path=/usr/local/php --disable-cli
--enable-force-cgi-redirect --enable-cgi --enable-mbstring



[2007-01-19 17:14:14] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Cannot reproduce.



[2007-01-19 17:05:50] sab2002a at yahoo dot com

Yes, that's what I did as per my previous comment.

No errors at all, email gets sent, and I get a An error occurred
message.



[2007-01-16 21:17:23] [EMAIL PROTECTED]

set_error_reporting(E_ALL);
ini_set(display_errors, 1);



[2007-01-16 19:20:07] sab2002a at yahoo dot com

I set error reporting and display errors on to max and still the same
thing.

I don't receive any error messages.



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/40139

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


#40186 [Asn-Bgs]: ORA-00932: inconsistent datatypes: expected CHAR got ARRAY

2007-01-21 Thread tony2001
 ID:   40186
 Updated by:   [EMAIL PROTECTED]
 Reported By:  tony at marston-home dot demon dot co dot uk
-Status:   Assigned
+Status:   Bogus
 Bug Type: OCI8 related
 Operating System: Windows XP
 PHP Version:  5.2.0
 Assigned To:  tony2001
 New Comment:

Use oci_bind_array_by_name() to fetch VARRAYs.


Previous Comments:


[2007-01-21 13:51:22] tony at marston-home dot demon dot co dot uk

Description:

I am using the latest OCI8 extension from PECL.

I have created a database table which contains a VARRAY user-defined
type as follows:

CREATE OR REPLACE TYPE t_fav_food IS VARRAY(10) OF NUMBER(2);
CREATE TABLE x_person (
  person_id varchar2(8) NOT NULL,
  first_name varchar2(20) NOT NULL,
  last_name varchar2(30) NOT NULL,
  favourite_food t_fav_food,
  PRIMARY KEY  (person_id)
);

I can write a record containing a VARRAY type, but I am unable to read
it as oci_fetch_array() fails with error ORA-00932.




Reproduce code:
---
?php
$dbconn = ociLogon('tony', 'tony', '//localhost/xe') or die('unable to
connect to database');
$query = TRUNCATE TABLE x_person;
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('truncate
failed');
$query = INSERT INTO x_person (person_id, first_name, last_name,
favourite_food) VALUES ('AJM','Tony','Marston', t_fav_food(1,3,5));
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('insert #1
failed');
$query = INSERT INTO x_person (person_id, first_name, last_name,
favourite_food) VALUES ('FB','Fred','Bloggs', t_fav_food(2,4,6));
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('insert #2
failed');
$query = SELECT * FROM x_person;
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt) or die('select failed');
while ($row = @oci_fetch_array ($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
$array[] = array_change_key_case($row, CASE_LOWER);
} // while
if ($error_array = oci_error($stmt)) {
echo 'Error code: ' .$error_array['code'] .\r\n;
echo 'Error msg : ' .$error_array['message'] .\r\n;
exit();
} // if
echo 'Done';
?


Expected result:

I expect the VARRAY column to be made available in my program so that
it can be processed using the oci-collection methods, similar to the
way CLOBs and BLOBs are handled.

This is what I can already do with the SET type in MySQL, and the ARRAY
type in PostgreSQL.

Actual result:
--
The call to oci_fetch_array() fails with ORA-00932: inconsistent
datatypes: expected CHAR got ARRAY. This means that I am unable to read
table that contains a VARRAY column.





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


#40191 [NEW]: use of array_unique triggers segfault

2007-01-21 Thread sammy- at gmx dot net
From: sammy- at gmx dot net
Operating system: Debian
PHP version:  5.2.0
PHP Bug Type: Arrays related
Bug description:  use of array_unique triggers segfault

Description:

when using array_unique to unify an ArrayObject, PHP runs into a segfault.

Reproduce code:
---
?php
$arrObj = new ArrayObject();
$arrObj-append('foo');
$arrObj-append('bar');
$arrObj-append('foo');

$arr = array_unique($arrObj);
?

Expected result:

array (
  [0] = 'foo',
  [1] = 'bar'
)

or Error

Actual result:
--
Segfault

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