#48432 [NEW]: (?{CODE}) pattern not recognized, won't compile expression

2009-05-30 Thread webmaster at adurosolutions dot com
From: webmaster at adurosolutions dot com
Operating system: CentOs
PHP version:  5.2.9
PHP Bug Type: PCRE related
Bug description:  (?{CODE}) pattern not recognized, won't compile expression

Description:

The (?{CODE}) regular expression has been in Perl since = 5.005, and 
the PHP documentation for PCRE says that it's current as of 5.005. This 
functionality does not appear to be functional in PHP 5.2.9.

Reproduce code:
---
?

$pattern = '/^(?{ $d=0
})(?:\((?{$d++})|\)(?{$d--})(?(?{$d0})(?!))|(?[^()]*))*(?(?{$d!=0})(?!))$/';

$pattern_simple = '/^(?{$d=0})\(/';

$subject = '((I)(like(pie))!)';

echo result: .preg_match($pattern, $subject).br/;

echo result_simple: .preg_match($pattern_simple, $subject).br/;

?

Expected result:

I'm not claiming that the regular expressions should produce a match, 
but they should compile and be evaluated, and thus return either a 0 or 
a 1.

Actual result:
--
Warning: preg_match() [function.preg-match]: Compilation failed: 
unrecognized character after (? or (?- at offset 2 in __FILE__ on line 
__LINE__

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



#48432 [Opn-Bgs]: (?{CODE}) pattern not recognized, won't compile expression

2009-05-30 Thread scottmac
 ID:   48432
 Updated by:   scott...@php.net
 Reported By:  webmaster at adurosolutions dot com
-Status:   Open
+Status:   Bogus
 Bug Type: PCRE related
 Operating System: CentOs
 PHP Version:  5.2.9
 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 manual clearly states we don't support this.

Fairly obviously, PCRE does not support the (?{code}) and (??{code})
construction. However, there is support for recursive patterns.


Previous Comments:


[2009-05-30 07:56:15] webmaster at adurosolutions dot com

Description:

The (?{CODE}) regular expression has been in Perl since = 5.005, and 
the PHP documentation for PCRE says that it's current as of 5.005. This

functionality does not appear to be functional in PHP 5.2.9.

Reproduce code:
---
?

$pattern = '/^(?{ $d=0
})(?:\((?{$d++})|\)(?{$d--})(?(?{$d0})(?!))|(?[^()]*))*(?(?{$d!=0})(?!))$/';

$pattern_simple = '/^(?{$d=0})\(/';

$subject = '((I)(like(pie))!)';

echo result: .preg_match($pattern, $subject).br/;

echo result_simple: .preg_match($pattern_simple, $subject).br/;

?

Expected result:

I'm not claiming that the regular expressions should produce a match, 
but they should compile and be evaluated, and thus return either a 0 or

a 1.

Actual result:
--
Warning: preg_match() [function.preg-match]: Compilation failed: 
unrecognized character after (? or (?- at offset 2 in __FILE__ on line

__LINE__





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



#48433 [NEW]: Case related bug in mb_ereg_* lookbehind

2009-05-30 Thread l_done at tiscali dot it
From: l_done at tiscali dot it
Operating system: Linux/OSX
PHP version:  5.2.9
PHP Bug Type: Regexps related
Bug description:  Case related bug in mb_ereg_* lookbehind

Description:

When using alternation in negative lookbehind in a case-insensitive regexp
with mb_ereg* functions, if the alternatives are of different lengths, the
first alternative is treated in a case-sensitive way.

Reproduce code:
---
$text='
aA 1
bBb 2
cCcc 3
dDddd 4
';

$pattern='(?!aa |bbb | )[1-4]';

mb_ereg_search_init($text,$pattern,'i');
$r=mb_ereg_search_pos();
while ($r!==false) {
$match=mb_ereg_search_getregs();
print_r($match);
$r=mb_ereg_search_pos();
}

Expected result:

Array
(
[0] = 4
)


Actual result:
--
Array
(
[0] = 1
)
Array
(
[0] = 4
)


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



#48434 [NEW]: memory function

2009-05-30 Thread busia at tiscali dot it
From: busia at tiscali dot it
Operating system: 
PHP version:  5.3.0RC2
PHP Bug Type: Feature/Change Request
Bug description:  memory function

Description:

You said me (#48368) that unset != free. The memory can remain occupied
also after I unset an array, that memory is reused when I set a new
variable and, for this reason, it's not a leak. Ok, now it's clear but a
problem remains: how can I optimize my code when I cannot see the php
internal memory use? I need a function like:

memory_get_usage() -
memory_allocated_but_usable_for_newly_created_variables();

Setting a variable and seeing that memory use don't change make scripts
impossible to optimize.

Thanks


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



#48433 [Opn]: Case related bug in mb_ereg_* lookbehind

2009-05-30 Thread l_done at tiscali dot it
 ID:   48433
 User updated by:  l_done at tiscali dot it
 Reported By:  l_done at tiscali dot it
 Status:   Open
 Bug Type: Regexps related
 Operating System: Linux/OSX
 PHP Version:  5.2.9
 New Comment:

I tested this with those php versions:

PHP 5.2.9 with Suhosin-Patch 0.9.7 (cli) (built: Mar 25 2009 12:11:14)
(archlinux)
PHP 5.2.8 (cli) (built: Feb  5 2009 21:21:13) (osx)
PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23
2009 14:37:14) (ubuntu 9.04)
PHP 5.2.4-2ubuntu5.6 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 17
2009 14:31:37) (ubuntu 8.04)


Previous Comments:


[2009-05-30 09:24:42] l_done at tiscali dot it

Description:

When using alternation in negative lookbehind in a case-insensitive
regexp with mb_ereg* functions, if the alternatives are of different
lengths, the first alternative is treated in a case-sensitive way.

Reproduce code:
---
$text='
aA 1
bBb 2
cCcc 3
dDddd 4
';

$pattern='(?!aa |bbb | )[1-4]';

mb_ereg_search_init($text,$pattern,'i');
$r=mb_ereg_search_pos();
while ($r!==false) {
$match=mb_ereg_search_getregs();
print_r($match);
$r=mb_ereg_search_pos();
}

Expected result:

Array
(
[0] = 4
)


Actual result:
--
Array
(
[0] = 1
)
Array
(
[0] = 4
)






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



#48434 [Opn-Bgs]: memory function

2009-05-30 Thread scottmac
 ID:  48434
 Updated by:  scott...@php.net
 Reported By: busia at tiscali dot it
-Status:  Open
+Status:  Bogus
 Bug Type:Feature/Change Request
 PHP Version: 5.3.0RC2
 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.

It's already there.
memory_get_usage() and memory_get_usage(true)




Previous Comments:


[2009-05-30 09:33:08] busia at tiscali dot it

Description:

You said me (#48368) that unset != free. The memory can remain occupied
also after I unset an array, that memory is reused when I set a new
variable and, for this reason, it's not a leak. Ok, now it's clear but a
problem remains: how can I optimize my code when I cannot see the php
internal memory use? I need a function like:

memory_get_usage() -
memory_allocated_but_usable_for_newly_created_variables();

Setting a variable and seeing that memory use don't change make scripts
impossible to optimize.

Thanks






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



#48434 [Bgs]: memory function

2009-05-30 Thread busia at tiscali dot it
 ID:  48434
 User updated by: busia at tiscali dot it
 Reported By: busia at tiscali dot it
 Status:  Bogus
 Bug Type:Feature/Change Request
 PHP Version: 5.3.0RC2
 New Comment:

I know memory_get_usage() and memory_get_usage(true). But they don't
resolve the problem because the memory is not freed always when I unset
a variable than memory_get_usage can return the same before and after
creating a variable. See #48368. You said me that internal php memory is
different from system allocated memory, and I want to access internal
php memory. Memory_get_usage (with or without the first parameter) allow
only to access to syem allocated memory.

Please reply


Previous Comments:


[2009-05-30 10:01:50] scott...@php.net

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.

It's already there.
memory_get_usage() and memory_get_usage(true)





[2009-05-30 09:33:08] busia at tiscali dot it

Description:

You said me (#48368) that unset != free. The memory can remain occupied
also after I unset an array, that memory is reused when I set a new
variable and, for this reason, it's not a leak. Ok, now it's clear but a
problem remains: how can I optimize my code when I cannot see the php
internal memory use? I need a function like:

memory_get_usage() -
memory_allocated_but_usable_for_newly_created_variables();

Setting a variable and seeing that memory use don't change make scripts
impossible to optimize.

Thanks






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



#48435 [NEW]: convertion of filename.eps to filename.jpg is not clear

2009-05-30 Thread guru dot indian at gmail dot com
From: guru dot indian at gmail dot com
Operating system: windows xp
PHP version:  5.2.9
PHP Bug Type: GD related
Bug description:  convertion of filename.eps to filename.jpg is not clear

Description:

Dear sir/madam, 

I did a image processing project using PHP GD library, in which i need to
convert a image file with extension filename.eps to jpg, I used
exec(convert path/to/sourcefile.eps path/to/dest.jpg) command. This process
converts RGB color format successfully but the eps file is in CMYK color
format which doesnt converts good. The output file is in different color
(seems to be inverted color). I think this is a bug. please take necessary
action to correct this problem in future versions of php. Hence first i
converted the eps file to pdf, and then i converted the pdf to jpg. this
somehow gave a little relevant output. 

Regards
Guru

Reproduce code:
---
---
From manual page: function.convert
---

exec(convert filename.eps -colorspace CMYK -quality 100 filename.jpg);
The image is in CMYK color format

Expected result:

The color of the eps file is magenta but the output is with green colored
image.


Actual result:
--
Need same color of image during conversion. 

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



#48434 [Bgs]: memory function

2009-05-30 Thread scottmac
 ID:  48434
 Updated by:  scott...@php.net
 Reported By: busia at tiscali dot it
 Status:  Bogus
 Bug Type:Feature/Change Request
 PHP Version: 5.3.0RC2
 New Comment:

memory_get_usage(true) is the memory allocated from the system.
memory_get_usage() is the memory currently in use by PHP.

?php

var_dump(memory_get_usage(), memory_get_usage(true));
$x = str_repeat('a', 4096);
var_dump(memory_get_usage(), memory_get_usage(true));
unset($x);
var_dump(memory_get_usage(), memory_get_usage(true));

Produces
int(332392) -- Initial
int(524288) -- system
int(336996) -- After variable set
int(524288) -- system
int(332916) -- After variable unset
int(524288) -- system


Previous Comments:


[2009-05-30 10:08:12] busia at tiscali dot it

I know memory_get_usage() and memory_get_usage(true). But they don't
resolve the problem because the memory is not freed always when I unset
a variable than memory_get_usage can return the same before and after
creating a variable. See #48368. You said me that internal php memory is
different from system allocated memory, and I want to access internal
php memory. Memory_get_usage (with or without the first parameter) allow
only to access to syem allocated memory.

Please reply



[2009-05-30 10:01:50] scott...@php.net

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.

It's already there.
memory_get_usage() and memory_get_usage(true)





[2009-05-30 09:33:08] busia at tiscali dot it

Description:

You said me (#48368) that unset != free. The memory can remain occupied
also after I unset an array, that memory is reused when I set a new
variable and, for this reason, it's not a leak. Ok, now it's clear but a
problem remains: how can I optimize my code when I cannot see the php
internal memory use? I need a function like:

memory_get_usage() -
memory_allocated_but_usable_for_newly_created_variables();

Setting a variable and seeing that memory use don't change make scripts
impossible to optimize.

Thanks






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



#48435 [Opn-Bgs]: convertion of filename.eps to filename.jpg is not clear

2009-05-30 Thread scottmac
 ID:   48435
 Updated by:   scott...@php.net
 Reported By:  guru dot indian at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: GD related
 Operating System: windows xp
 PHP Version:  5.2.9
 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.

This is ImageMagick you are using, nothing to do with PHP here.


Previous Comments:


[2009-05-30 11:25:35] guru dot indian at gmail dot com

Description:

Dear sir/madam, 

I did a image processing project using PHP GD library, in which i need
to convert a image file with extension filename.eps to jpg, I used
exec(convert path/to/sourcefile.eps path/to/dest.jpg) command. This
process converts RGB color format successfully but the eps file is in
CMYK color format which doesnt converts good. The output file is in
different color (seems to be inverted color). I think this is a bug.
please take necessary action to correct this problem in future versions
of php. Hence first i converted the eps file to pdf, and then i
converted the pdf to jpg. this somehow gave a little relevant output. 

Regards
Guru

Reproduce code:
---
---
From manual page: function.convert
---

exec(convert filename.eps -colorspace CMYK -quality 100
filename.jpg);
The image is in CMYK color format

Expected result:

The color of the eps file is magenta but the output is with green
colored image.


Actual result:
--
Need same color of image during conversion. 





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



#48416 [Csd]: Memleak in ereg() and eregi() functions

2009-05-30 Thread bmorel at ssi dot fr
 ID:   48416
 User updated by:  bmorel at ssi dot fr
 Reported By:  bmorel at ssi dot fr
 Status:   Closed
 Bug Type: Regexps related
 Operating System: CentOS 5.3
 PHP Version:  5.2.9
 New Comment:

My mistake, I didn't use the correct php binary.
Successfully checked PHP 5.2, 5.3 and 6.0
Sorry and thank you for your fix !


Previous Comments:


[2009-05-29 23:14:01] scott...@php.net

I just downloaded a snapshot of 5.2 to check and its definitely fixed.

Memory peaks at 4mb, you must be doing something wrong.



[2009-05-29 21:39:03] bmorel at ssi dot fr

Thanks, but the problem is still there in the latest snapshots.
Just verified it on :

php5.2-200905292030
php5.3-200905292030
php6.0-200905292030

Memory usage still gets so high !
Ben



[2009-05-29 00:06:16] scott...@php.net

Fixed in 5.2 as well now.



[2009-05-28 21:58:10] scott...@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Added a LRU and a cache limit to the ereg code for 5.3.

Give it a few hours and grab another 5.3 snapshot, not sure about
fixing this in 5.2. Will check with ilia.



[2009-05-28 18:17:49] bmorel at ssi dot fr

Sorry, same problem with this snapshot (PHP 5.3.0RC3-dev :
php5.3-200905281630).

The cache seems to be a good explanation, but it this a good idea ?
I have millions of ereg()s done when I parse huge XML files (several
GB), and my memory usage goes too high. I had to replace all my ereg()s
with preg_match()s.

Thanks,
Ben



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

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



#48434 [Bgs]: memory function

2009-05-30 Thread lbarnaud
 ID:  48434
 Updated by:  lbarn...@php.net
 Reported By: busia at tiscali dot it
 Status:  Bogus
 Bug Type:Feature/Change Request
 PHP Version: 5.3.0RC2
 New Comment:

scott you are right, however it seems the behavior differs a bit when
unset()ing small-enough variables.

memory_get_usage(false) does not takes into account the small blocks
cache used by the allocator (not the same as the malloc()ed blocks
cache).

This causes the reported memory usage to not always decrease when
unset()ing a variable:

?php
$foo = bar;

var_dump(memory_get_usage());
var_dump(memory_get_usage());

unset($foo);
var_dump(memory_get_usage());
?

int(91448) -- first call
int(91696) -- before unset
int(91696) -- after unset (== before unset)

This patch may fix this:
Index: Zend/zend_alloc.c
===
RCS file: /repository/ZendEngine2/zend_alloc.c,v
retrieving revision 1.144.2.3.2.43.2.23
diff -u -p -r1.144.2.3.2.43.2.23 zend_alloc.c
--- Zend/zend_alloc.c   1 Apr 2009 16:55:47 -   1.144.2.3.2.43.2.23
+++ Zend/zend_alloc.c   30 May 2009 12:12:48 -
@@ -2496,7 +2496,11 @@ ZEND_API size_t zend_memory_usage(int re
if (real_usage) {
return AG(mm_heap)-real_size;
} else {
-   return AG(mm_heap)-size;
+   size_t usage = AG(mm_heap)-size;
+#if ZEND_MM_CACHE
+   usage -= AG(mm_heap)-cached;
+#endif
+   return usage;
}
 }



Previous Comments:


[2009-05-30 11:42:31] scott...@php.net

memory_get_usage(true) is the memory allocated from the system.
memory_get_usage() is the memory currently in use by PHP.

?php

var_dump(memory_get_usage(), memory_get_usage(true));
$x = str_repeat('a', 4096);
var_dump(memory_get_usage(), memory_get_usage(true));
unset($x);
var_dump(memory_get_usage(), memory_get_usage(true));

Produces
int(332392) -- Initial
int(524288) -- system
int(336996) -- After variable set
int(524288) -- system
int(332916) -- After variable unset
int(524288) -- system



[2009-05-30 10:08:12] busia at tiscali dot it

I know memory_get_usage() and memory_get_usage(true). But they don't
resolve the problem because the memory is not freed always when I unset
a variable than memory_get_usage can return the same before and after
creating a variable. See #48368. You said me that internal php memory is
different from system allocated memory, and I want to access internal
php memory. Memory_get_usage (with or without the first parameter) allow
only to access to syem allocated memory.

Please reply



[2009-05-30 10:01:50] scott...@php.net

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.

It's already there.
memory_get_usage() and memory_get_usage(true)





[2009-05-30 09:33:08] busia at tiscali dot it

Description:

You said me (#48368) that unset != free. The memory can remain occupied
also after I unset an array, that memory is reused when I set a new
variable and, for this reason, it's not a leak. Ok, now it's clear but a
problem remains: how can I optimize my code when I cannot see the php
internal memory use? I need a function like:

memory_get_usage() -
memory_allocated_but_usable_for_newly_created_variables();

Setting a variable and seeing that memory use don't change make scripts
impossible to optimize.

Thanks






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



#48434 [Bgs]: memory function

2009-05-30 Thread busia at tiscali dot it
 ID:  48434
 User updated by: busia at tiscali dot it
 Reported By: busia at tiscali dot it
 Status:  Bogus
 Bug Type:Feature/Change Request
 PHP Version: 5.3.0RC2
 New Comment:

I unsderstand what you say but my request is different: when I posted
bug #48368, j...@php.net answered me:

unset != free. The memory is freed once the process shuts down. Until 
that, it's available inside the process. This is not a leak.


I need a function that tell me the amount of this memory available
inside the process or even better the difference between
memory_get_usage() and this memory available inside the process.

I don't think this is bogus, i think this must be an open feature
request.

Thanks


Previous Comments:


[2009-05-30 12:23:24] lbarn...@php.net

scott you are right, however it seems the behavior differs a bit when
unset()ing small-enough variables.

memory_get_usage(false) does not takes into account the small blocks
cache used by the allocator (not the same as the malloc()ed blocks
cache).

This causes the reported memory usage to not always decrease when
unset()ing a variable:

?php
$foo = bar;

var_dump(memory_get_usage());
var_dump(memory_get_usage());

unset($foo);
var_dump(memory_get_usage());
?

int(91448) -- first call
int(91696) -- before unset
int(91696) -- after unset (== before unset)

This patch may fix this:
Index: Zend/zend_alloc.c
===
RCS file: /repository/ZendEngine2/zend_alloc.c,v
retrieving revision 1.144.2.3.2.43.2.23
diff -u -p -r1.144.2.3.2.43.2.23 zend_alloc.c
--- Zend/zend_alloc.c   1 Apr 2009 16:55:47 -   1.144.2.3.2.43.2.23
+++ Zend/zend_alloc.c   30 May 2009 12:12:48 -
@@ -2496,7 +2496,11 @@ ZEND_API size_t zend_memory_usage(int re
if (real_usage) {
return AG(mm_heap)-real_size;
} else {
-   return AG(mm_heap)-size;
+   size_t usage = AG(mm_heap)-size;
+#if ZEND_MM_CACHE
+   usage -= AG(mm_heap)-cached;
+#endif
+   return usage;
}
 }




[2009-05-30 11:42:31] scott...@php.net

memory_get_usage(true) is the memory allocated from the system.
memory_get_usage() is the memory currently in use by PHP.

?php

var_dump(memory_get_usage(), memory_get_usage(true));
$x = str_repeat('a', 4096);
var_dump(memory_get_usage(), memory_get_usage(true));
unset($x);
var_dump(memory_get_usage(), memory_get_usage(true));

Produces
int(332392) -- Initial
int(524288) -- system
int(336996) -- After variable set
int(524288) -- system
int(332916) -- After variable unset
int(524288) -- system



[2009-05-30 10:08:12] busia at tiscali dot it

I know memory_get_usage() and memory_get_usage(true). But they don't
resolve the problem because the memory is not freed always when I unset
a variable than memory_get_usage can return the same before and after
creating a variable. See #48368. You said me that internal php memory is
different from system allocated memory, and I want to access internal
php memory. Memory_get_usage (with or without the first parameter) allow
only to access to syem allocated memory.

Please reply



[2009-05-30 10:01:50] scott...@php.net

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.

It's already there.
memory_get_usage() and memory_get_usage(true)





[2009-05-30 09:33:08] busia at tiscali dot it

Description:

You said me (#48368) that unset != free. The memory can remain occupied
also after I unset an array, that memory is reused when I set a new
variable and, for this reason, it's not a leak. Ok, now it's clear but a
problem remains: how can I optimize my code when I cannot see the php
internal memory use? I need a function like:

memory_get_usage() -
memory_allocated_but_usable_for_newly_created_variables();

Setting a variable and seeing that memory use don't change make scripts
impossible to optimize.

Thanks






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



#48434 [Bgs]: memory function

2009-05-30 Thread scottmac
 ID:  48434
 Updated by:  scott...@php.net
 Reported By: busia at tiscali dot it
 Status:  Bogus
 Bug Type:Feature/Change Request
 PHP Version: 5.3.0RC2
 New Comment:

What aren't you understanding?

memory_get_usage(true) = memory allocated to process from system
memory_get_usage() = memory actually in use for PHP

Therefore
memory_get_usage(true) - memory_get_usage()

That's the memory that has been allocated from the system but isn't
used for variables yet.


Previous Comments:


[2009-05-30 13:00:52] busia at tiscali dot it

I unsderstand what you say but my request is different: when I posted
bug #48368, j...@php.net answered me:

unset != free. The memory is freed once the process shuts down. Until 
that, it's available inside the process. This is not a leak.


I need a function that tell me the amount of this memory available
inside the process or even better the difference between
memory_get_usage() and this memory available inside the process.

I don't think this is bogus, i think this must be an open feature
request.

Thanks



[2009-05-30 12:23:24] lbarn...@php.net

scott you are right, however it seems the behavior differs a bit when
unset()ing small-enough variables.

memory_get_usage(false) does not takes into account the small blocks
cache used by the allocator (not the same as the malloc()ed blocks
cache).

This causes the reported memory usage to not always decrease when
unset()ing a variable:

?php
$foo = bar;

var_dump(memory_get_usage());
var_dump(memory_get_usage());

unset($foo);
var_dump(memory_get_usage());
?

int(91448) -- first call
int(91696) -- before unset
int(91696) -- after unset (== before unset)

This patch may fix this:
Index: Zend/zend_alloc.c
===
RCS file: /repository/ZendEngine2/zend_alloc.c,v
retrieving revision 1.144.2.3.2.43.2.23
diff -u -p -r1.144.2.3.2.43.2.23 zend_alloc.c
--- Zend/zend_alloc.c   1 Apr 2009 16:55:47 -   1.144.2.3.2.43.2.23
+++ Zend/zend_alloc.c   30 May 2009 12:12:48 -
@@ -2496,7 +2496,11 @@ ZEND_API size_t zend_memory_usage(int re
if (real_usage) {
return AG(mm_heap)-real_size;
} else {
-   return AG(mm_heap)-size;
+   size_t usage = AG(mm_heap)-size;
+#if ZEND_MM_CACHE
+   usage -= AG(mm_heap)-cached;
+#endif
+   return usage;
}
 }




[2009-05-30 11:42:31] scott...@php.net

memory_get_usage(true) is the memory allocated from the system.
memory_get_usage() is the memory currently in use by PHP.

?php

var_dump(memory_get_usage(), memory_get_usage(true));
$x = str_repeat('a', 4096);
var_dump(memory_get_usage(), memory_get_usage(true));
unset($x);
var_dump(memory_get_usage(), memory_get_usage(true));

Produces
int(332392) -- Initial
int(524288) -- system
int(336996) -- After variable set
int(524288) -- system
int(332916) -- After variable unset
int(524288) -- system



[2009-05-30 10:08:12] busia at tiscali dot it

I know memory_get_usage() and memory_get_usage(true). But they don't
resolve the problem because the memory is not freed always when I unset
a variable than memory_get_usage can return the same before and after
creating a variable. See #48368. You said me that internal php memory is
different from system allocated memory, and I want to access internal
php memory. Memory_get_usage (with or without the first parameter) allow
only to access to syem allocated memory.

Please reply



[2009-05-30 10:01:50] scott...@php.net

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.

It's already there.
memory_get_usage() and memory_get_usage(true)





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

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



#48434 [Bgs]: memory function

2009-05-30 Thread busia at tiscali dot it
 ID:  48434
 User updated by: busia at tiscali dot it
 Reported By: busia at tiscali dot it
 Status:  Bogus
 Bug Type:Feature/Change Request
 PHP Version: 5.3.0RC2
 New Comment:

Look this code:

?
ini_set('memory_limit','300M');
class a {
}

echo a - .(memory_get_usage(true) - memory_get_usage()).\n;
$a=array();
for ($i=0; $i=100; $i++) {
$a[]= new a();
}
echo b - .(memory_get_usage(true) - memory_get_usage()).\n;
unset($a);
echo c - .(memory_get_usage(true) - memory_get_usage()).\n;
$foo=1;
echo d - .(memory_get_usage(true) - memory_get_usage()).\n;
?
-
That show

a - 201640
b - 774800
c - 685360
d - 685360

If it is as you said the output near d should be different from the
output near c but they are identical. I want to know how many internal
mamory is used from the $foo variable. I know the the system memory is
the same because php don't make always garbage collection but it collect
on the request end bue i want to be able to know how much memory is
interested by section of code. Using your code seems that $foo is
registered on the void.

Thanks


Previous Comments:


[2009-05-30 13:29:54] scott...@php.net

What aren't you understanding?

memory_get_usage(true) = memory allocated to process from system
memory_get_usage() = memory actually in use for PHP

Therefore
memory_get_usage(true) - memory_get_usage()

That's the memory that has been allocated from the system but isn't
used for variables yet.



[2009-05-30 13:00:52] busia at tiscali dot it

I unsderstand what you say but my request is different: when I posted
bug #48368, j...@php.net answered me:

unset != free. The memory is freed once the process shuts down. Until 
that, it's available inside the process. This is not a leak.


I need a function that tell me the amount of this memory available
inside the process or even better the difference between
memory_get_usage() and this memory available inside the process.

I don't think this is bogus, i think this must be an open feature
request.

Thanks



[2009-05-30 12:23:24] lbarn...@php.net

scott you are right, however it seems the behavior differs a bit when
unset()ing small-enough variables.

memory_get_usage(false) does not takes into account the small blocks
cache used by the allocator (not the same as the malloc()ed blocks
cache).

This causes the reported memory usage to not always decrease when
unset()ing a variable:

?php
$foo = bar;

var_dump(memory_get_usage());
var_dump(memory_get_usage());

unset($foo);
var_dump(memory_get_usage());
?

int(91448) -- first call
int(91696) -- before unset
int(91696) -- after unset (== before unset)

This patch may fix this:
Index: Zend/zend_alloc.c
===
RCS file: /repository/ZendEngine2/zend_alloc.c,v
retrieving revision 1.144.2.3.2.43.2.23
diff -u -p -r1.144.2.3.2.43.2.23 zend_alloc.c
--- Zend/zend_alloc.c   1 Apr 2009 16:55:47 -   1.144.2.3.2.43.2.23
+++ Zend/zend_alloc.c   30 May 2009 12:12:48 -
@@ -2496,7 +2496,11 @@ ZEND_API size_t zend_memory_usage(int re
if (real_usage) {
return AG(mm_heap)-real_size;
} else {
-   return AG(mm_heap)-size;
+   size_t usage = AG(mm_heap)-size;
+#if ZEND_MM_CACHE
+   usage -= AG(mm_heap)-cached;
+#endif
+   return usage;
}
 }




[2009-05-30 11:42:31] scott...@php.net

memory_get_usage(true) is the memory allocated from the system.
memory_get_usage() is the memory currently in use by PHP.

?php

var_dump(memory_get_usage(), memory_get_usage(true));
$x = str_repeat('a', 4096);
var_dump(memory_get_usage(), memory_get_usage(true));
unset($x);
var_dump(memory_get_usage(), memory_get_usage(true));

Produces
int(332392) -- Initial
int(524288) -- system
int(336996) -- After variable set
int(524288) -- system
int(332916) -- After variable unset
int(524288) -- system



[2009-05-30 10:08:12] busia at tiscali dot it

I know memory_get_usage() and memory_get_usage(true). But they don't
resolve the problem because the memory is not freed always when I unset
a variable than memory_get_usage can return the same before and after
creating a variable. See #48368. You said me that internal php memory is
different from system allocated memory, and I want to access internal
php memory. Memory_get_usage (with or without the first parameter) allow
only to access to syem allocated memory.

Please reply




#48409 [Fbk-Csd]: Exception + nested functions + classes crash PHP 5.2

2009-05-30 Thread lbarnaud
 ID:   48409
 Updated by:   lbarn...@php.net
 Reported By:  nightstorm at tlen dot pl
-Status:   Feedback
+Status:   Closed
 Bug Type: Reproducible crash
-Operating System: Linux 64bit gcc
+Operating System: Linux gcc
 PHP Version:  5.2CVS-2009-05-27 (snap)
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:


[2009-05-27 19:22:06] j...@php.net

Arnaud: I'd like to see the reportee's answers to my questions. And I 
tested in 64bit system, gcc 4.1.2. 

What was the GCC version you (both) used? :)



[2009-05-27 18:42:08] lbarn...@php.net

Looks like the same as bug #48228

Can reproduce on a 64bit system, not on 32bit.
./configure --disable-all, default CFLAGS (-O2)



[2009-05-27 18:28:29] j...@php.net

Note: I can not reproduce this.



[2009-05-27 18:27:27] j...@php.net

Did you use --enable-debug or not? Change -O (optimizer level) compile

parameter?



[2009-05-27 18:26:30] j...@php.net

?php

class ABCException extends Exception {}

class BBB
{
public function xyz($d, $x)
{
if ($x == 34) {
throw new ABCException;
}
return array('foo' = 'xyz');
}
}

class CCC
{
public function process($p)
{
return $p;
}
}

class AAA
{
public function func()
{
$b = new BBB;
$c = new CCC;
$i = 34;
$item = array('foo' = 'bar');
try {
$c-process($b-xyz($item['foo'], $i));
}
catch(ABCException $e) {
$b-xyz($item['foo'], $i);
}
} // end func();
}

class Runner
{
public function run($x)
{
try {
$x-func();
}
catch(ABCException $e) {
throw new Exception;
}
}
}

try {
$runner = new Runner;
$runner-run(new AAA);
}
catch(Exception $e) {
die('Exception thrown');
}

?



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

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



#48434 [Bgs-Csd]: memory function

2009-05-30 Thread lbarnaud
 ID:  48434
 Updated by:  lbarn...@php.net
 Reported By: busia at tiscali dot it
-Status:  Bogus
+Status:  Closed
-Bug Type:Feature/Change Request
+Bug Type:*General Issues
 PHP Version: 5.3.0RC2
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:


[2009-05-30 14:35:56] busia at tiscali dot it

Look this code:

?
ini_set('memory_limit','300M');
class a {
}

echo a - .(memory_get_usage(true) - memory_get_usage()).\n;
$a=array();
for ($i=0; $i=100; $i++) {
$a[]= new a();
}
echo b - .(memory_get_usage(true) - memory_get_usage()).\n;
unset($a);
echo c - .(memory_get_usage(true) - memory_get_usage()).\n;
$foo=1;
echo d - .(memory_get_usage(true) - memory_get_usage()).\n;
?
-
That show

a - 201640
b - 774800
c - 685360
d - 685360

If it is as you said the output near d should be different from the
output near c but they are identical. I want to know how many internal
mamory is used from the $foo variable. I know the the system memory is
the same because php don't make always garbage collection but it collect
on the request end bue i want to be able to know how much memory is
interested by section of code. Using your code seems that $foo is
registered on the void.

Thanks



[2009-05-30 13:29:54] scott...@php.net

What aren't you understanding?

memory_get_usage(true) = memory allocated to process from system
memory_get_usage() = memory actually in use for PHP

Therefore
memory_get_usage(true) - memory_get_usage()

That's the memory that has been allocated from the system but isn't
used for variables yet.



[2009-05-30 13:00:52] busia at tiscali dot it

I unsderstand what you say but my request is different: when I posted
bug #48368, j...@php.net answered me:

unset != free. The memory is freed once the process shuts down. Until 
that, it's available inside the process. This is not a leak.


I need a function that tell me the amount of this memory available
inside the process or even better the difference between
memory_get_usage() and this memory available inside the process.

I don't think this is bogus, i think this must be an open feature
request.

Thanks



[2009-05-30 12:23:24] lbarn...@php.net

scott you are right, however it seems the behavior differs a bit when
unset()ing small-enough variables.

memory_get_usage(false) does not takes into account the small blocks
cache used by the allocator (not the same as the malloc()ed blocks
cache).

This causes the reported memory usage to not always decrease when
unset()ing a variable:

?php
$foo = bar;

var_dump(memory_get_usage());
var_dump(memory_get_usage());

unset($foo);
var_dump(memory_get_usage());
?

int(91448) -- first call
int(91696) -- before unset
int(91696) -- after unset (== before unset)

This patch may fix this:
Index: Zend/zend_alloc.c
===
RCS file: /repository/ZendEngine2/zend_alloc.c,v
retrieving revision 1.144.2.3.2.43.2.23
diff -u -p -r1.144.2.3.2.43.2.23 zend_alloc.c
--- Zend/zend_alloc.c   1 Apr 2009 16:55:47 -   1.144.2.3.2.43.2.23
+++ Zend/zend_alloc.c   30 May 2009 12:12:48 -
@@ -2496,7 +2496,11 @@ ZEND_API size_t zend_memory_usage(int re
if (real_usage) {
return AG(mm_heap)-real_size;
} else {
-   return AG(mm_heap)-size;
+   size_t usage = AG(mm_heap)-size;
+#if ZEND_MM_CACHE
+   usage -= AG(mm_heap)-cached;
+#endif
+   return usage;
}
 }




[2009-05-30 11:42:31] scott...@php.net

memory_get_usage(true) is the memory allocated from the system.
memory_get_usage() is the memory currently in use by PHP.

?php

var_dump(memory_get_usage(), memory_get_usage(true));
$x = str_repeat('a', 4096);
var_dump(memory_get_usage(), memory_get_usage(true));
unset($x);
var_dump(memory_get_usage(), memory_get_usage(true));

Produces
int(332392) -- Initial
int(524288) -- system
int(336996) -- After variable set
int(524288) -- system
int(332916) -- After variable unset
int(524288) -- system



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

-- 
Edit this bug report at 

#48418 [Opn]: NaN NaN, NaN 0, NaN 0 return true

2009-05-30 Thread kalle
 ID:   48418
 Updated by:   ka...@php.net
 Reported By:  phplists at stanvassilev dot com
 Status:   Open
 Bug Type: Math related
 Operating System: Linux, BSD, possibly all *nix
 PHP Version:  5.2.9
 New Comment:

C:\php\srcphp -v
PHP 5.3.0RC3-dev (cli) (built: May 29 2009 09:57:23)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

C:\php\srcphp -r $nan = sqrt(-1); var_dump($nan, $nan  $nan, $nan 
0, $nan  0);
float(NAN)
bool(true)
bool(true)
bool(true)

Same on Windows


Previous Comments:


[2009-05-28 19:05:20] phplists at stanvassilev dot com

And to add a note:

$NaN = $NaN
$NaN = 0
$NaN = 0

These also return true and must return false.



[2009-05-28 18:57:57] phplists at stanvassilev dot com

Description:

Tested on Gentoo, CentOS, OSX. 

This is possibly NOT related to the Windows NaN bug, as Windows is NOT

affected by this issue. 

However, please test if any fix doesn't cause regression on Windows.

NaN  NaN, NaN  0, NaN  0 return true, while they should return false

in all cases (any comparison where either side is NaN, should return 
false).

Reproduce code:
---
$NaN = sqrt(-1);
var_dump($NaN  $NaN);
var_dump($NaN  0);
var_dump($NaN  0); 

Expected result:

float(NAN)
bool(false)
bool(false)
bool(false)

Actual result:
--
float(NAN)
bool(true)
bool(true)
bool(true)





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



#48202 [Asn]: Out of memory error when passing non-existing filename to xmlwriter_open_uri()

2009-05-30 Thread pajoye
 ID:   48202
 Updated by:   paj...@php.net
 Reported By:  koenk82 at gmail dot com
 Status:   Assigned
 Bug Type: XML Writer
 Operating System: *
 PHP Version:  5.*, 6CVS (2009-05-09)
 Assigned To:  pajoye
 New Comment:

I found the problem, it is a bug in libxml's xmlwriter. It does not
check correctly the return value from the createfilename callback.


Previous Comments:


[2009-05-26 14:12:42] fel...@php.net

It's reproducible yet.

$ sapi/cli/php -r 'xmlwriter_open_uri(file:///a);'

Warning: xmlwriter_open_uri(/a): failed to open stream: Permission
denied in Command line code on line 1

Warning: xmlwriter_open_uri(): xmlNewTextWriterFilename : out of
memory! in Command line code on line 1



[2009-05-25 16:53:52] paj...@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

fixed in 5.2, 5.3 and HEAD



[2009-05-09 13:04:56] paj...@php.net

reproduced during the testfest 2009/utrecht, assigning to me.



[2009-05-09 12:40:13] koenk82 at gmail dot com

Description:

If you supply a non-existing file to xmlwriter_open_uri it produces an
Out of memory error.

Reproduce code:
---
?php 
var_dump(xmlwriter_open_uri('foo/bar.tmp'));
?

Expected result:

Warning: xmlwriter_open_uri(%s): failed to open stream: No such file or
directory in %s on line %d
bool(false)

Actual result:
--
Warning: xmlwriter_open_uri(/home/koen/Bureaublad/php5/foo/bar.tmp):
failed to open stream: No such file or directory in
/home/koen/Bureaublad/mytests/xmlwriter_open_uri_error_003.php on line
2

Warning: xmlwriter_open_uri(): xmlNewTextWriterFilename : out of
memory! in
/home/koen/Bureaublad/mytests/xmlwriter_open_uri_error_003.php on line
2
bool(false)





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



#45254 [Com]: PHP does not time out when accepting for connections while working as FastCGI

2009-05-30 Thread fredric at drombolaget dot se
 ID:   45254
 Comment by:   fredric at drombolaget dot se
 Reported By:  yurtesen at ispro dot net
 Status:   No Feedback
 Bug Type: CGI related
 Operating System: FreeBSD 6.3
 PHP Version:  5.2.6
 New Comment:

I have the exact same problem right now on our VPS.

The VPS is running Ubuntu 8.04 64 bit on OpenVZ. The install of the
software is from Ubuntu standard repositories.

The software is:
Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
mod_ssl/2.2.8 OpenSSL/0.9.8g

Occassionally a php-cgi process hangs or rather does absolutely
nothing - but it does consume memory. As the number of processes
approaches the 30:s the server starts dying from acute lack of memory.

killall -9 php-cgi is still all that get's us out of this mess.
Restarting apache doesn't even work as it seems to be waiting for the
php processes to die.


Previous Comments:


[2008-07-23 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.



[2008-07-15 20:54:33] j...@php.net

Please try using this CVS snapshot:

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

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi





[2008-07-13 21:52:37] s dot tretter at szene1 dot at

sorry, some more information about my software setup:
using apache 2.2.6, but preforked. fastcgi 2.4.6, php 5.2.6 but problem
exist with all php version i ever used.

my compile options for php:
'./configure' \
'--enable-fastcgi' \
'--enable-force-cgi-redirect' \
'--with-pcre-regex' \
'--without-sqlite' \
'--with-mysqli' \
'--with-gd' \
'--with-ttf' \
'--enable-exif' \
'--with-mcrypt' \
'--enable-mbstring' \
'--enable-spl' \
'--prefix=/usr/local/php5' \
'--with-zlib' \
'--enable-gd-native-ttf' \
'--enable-sockets' \
'--enable-soap' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
$@



[2008-07-13 21:47:27] s dot tretter at szene1 dot at

same problem, php just hangs and doesn't exit. the only possible
solution to kill all php processes is killall -9 php-cgi a simple
killall (without -9) doesn't help.

no idea what is causing the php process to hang but it doesn't help to
increase or decrease the PHP_FCGI_CHILDREN and PHP_FCGI_MAX_REQUESTS
variables. no solution found until yet, and I also have to restart
apache every day and this is very annoying on a server farm with more
than 30 web servers.

googled a lot of time, some people say there is a relation between an
accepting socket and an loosy internet connection .. in case of a post
request the php process could hang if there is no real syn packet or
similar...

for other bug reports or people with similar problems just ask google
for fastcgi php hang

ng
sorry for my bad english ;)



[2008-06-15 16:14:13] ruanchunping at gmail dot com

I use lighttpd1.4.19 + php-cgi (5.2.6) @ FreeBSD 7.0 amd64

I found that ,the *POST* request sometimes hangs for ever,  
the lighttpd status report:

handle-req  59339(time)
handle-req  58478
handle-req  57985
..

there are over 100 php-cgi processes in this status pre day.
i have to restart lighttpd every day.

these POST request are posting blog or uploading photos.



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

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



#48202 [Asn]: Out of memory error when passing non-existing filename to xmlwriter_open_uri()

2009-05-30 Thread pajoye
 ID:   48202
 Updated by:   paj...@php.net
 Reported By:  koenk82 at gmail dot com
 Status:   Assigned
 Bug Type: XML Writer
 Operating System: *
 PHP Version:  5.*, 6CVS (2009-05-09)
-Assigned To:  pajoye
+Assigned To:  rrichards
 New Comment:

Rob, can you take a look please?

Maybe change the error in xmlNewTextWriterFilename from:

out = xmlOutputBufferCreateFilename(uri, NULL, compression);
if (out == NULL) {
xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
xmlNewTextWriterFilename : out of
memory!\n);
return NULL;
}

to

out = xmlOutputBufferCreateFilename(uri, NULL, compression);
if (out == NULL) {
xmlWriterErrMsg(NULL, XML_EIO,
xmlNewTextWriterFilename : cannot create file
%s\n, uri);
return NULL;
}



Previous Comments:


[2009-05-30 20:59:38] paj...@php.net

I found the problem, it is a bug in libxml's xmlwriter. It does not
check correctly the return value from the createfilename callback.



[2009-05-26 14:12:42] fel...@php.net

It's reproducible yet.

$ sapi/cli/php -r 'xmlwriter_open_uri(file:///a);'

Warning: xmlwriter_open_uri(/a): failed to open stream: Permission
denied in Command line code on line 1

Warning: xmlwriter_open_uri(): xmlNewTextWriterFilename : out of
memory! in Command line code on line 1



[2009-05-25 16:53:52] paj...@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

fixed in 5.2, 5.3 and HEAD



[2009-05-09 13:04:56] paj...@php.net

reproduced during the testfest 2009/utrecht, assigning to me.



[2009-05-09 12:40:13] koenk82 at gmail dot com

Description:

If you supply a non-existing file to xmlwriter_open_uri it produces an
Out of memory error.

Reproduce code:
---
?php 
var_dump(xmlwriter_open_uri('foo/bar.tmp'));
?

Expected result:

Warning: xmlwriter_open_uri(%s): failed to open stream: No such file or
directory in %s on line %d
bool(false)

Actual result:
--
Warning: xmlwriter_open_uri(/home/koen/Bureaublad/php5/foo/bar.tmp):
failed to open stream: No such file or directory in
/home/koen/Bureaublad/mytests/xmlwriter_open_uri_error_003.php on line
2

Warning: xmlwriter_open_uri(): xmlNewTextWriterFilename : out of
memory! in
/home/koen/Bureaublad/mytests/xmlwriter_open_uri_error_003.php on line
2
bool(false)





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



#48436 [NEW]: No error's displayed with the Win32 version of PHP

2009-05-30 Thread m dot de dot roo at tiscali dot nl
From: m dot de dot roo at tiscali dot nl
Operating system: WinXP
PHP version:  5.2.9
PHP Bug Type: Scripting Engine problem
Bug description:  No error's displayed with the Win32 version of PHP

Description:

No error's displayed with the Win32 version of PHP

Reproduce code:
---
Any error in the code

Expected result:

An PHP error message

Actual result:
--
Empty screen

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