Bug #55115 [Asn->Bgs]: Large segment of memory still reachable with more than one request

2011-07-21 Thread moriyoshi
Edit report at https://bugs.php.net/bug.php?id=55115&edit=1

 ID: 55115
 Updated by: moriyo...@php.net
 Reported by:ar...@php.net
 Summary:Large segment of memory still reachable with more
 than one request
-Status: Assigned
+Status: Bogus
 Type:   Bug
 Package:Built-in web server
 Operating System:   Ubuntu
 PHP Version:5.4SVN-2011-07-03 (SVN)
 Assigned To:moriyoshi
 Block user comment: N
 Private report: N

 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

This seems to be caused by the Valgrind's strange behavior.  Valgrind 
terminates 
the program immediately when the signal was sent during a interruptible system 
call.  It eventually fails to call necessary shutdown functions, and results in 
massive leaks.


Previous Comments:

[2011-07-06 16:13:09] s...@php.net

If use the RFC routing example, starting the server as "php -S localhost:8000 
routing.php" and browse for an existing JPG files, I see:

PHP Development Server is listening on localhost:8000 in 
/home/cjones/public_html ... Press Ctrl-C to quit.
[Wed Jul  6 13:09:58 2011] ::1:39867: /oraclelogo.jpg
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/main/output.c(802) :  Freeing 
0xB4F53250 (48 bytes), script=/home/cjones/public_html/oraclelogo.jpg
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/Zend/zend_alloc.c(2529) : 
Actual location (location was relayed)
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/main/output.c(803) :  Freeing 
0xB4F532AC (23 bytes), script=/home/cjones/public_html/oraclelogo.jpg
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/main/output.c(808) :  Freeing 
0xB4F532F0 (8192 bytes), script=/home/cjones/public_html/oraclelogo.jpg
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/Zend/zend_stack.c(37) :  
Freeing 0xB4F5531C (256 bytes), script=/home/cjones/public_html/oraclelogo.jpg
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/Zend/zend_stack.c(42) :  
Freeing 0xB4F55448 (4 bytes), script=/home/cjones/public_html/oraclelogo.jpg
=== Total 5 memory leaks detected ===
[Wed Jul  6 13:09:59 2011] ::1:39868: /favicon.ico

If I repeat this with valgrind, I see the same output.  After ^C, I get 5.5K 
loss records reported by valgrind.


[2011-07-03 00:32:32] ar...@php.net

Description:

When using the CLI server, more than one access results in a huge amount of 
still reachable memory.

Test script:
---
touch t.php
valgrind --leak-check=full --show-reachable=yes php -S localhost:8080
[browser] /t.php
[browser] /t.php


Actual result:
--
55k lines of segments that are apparently still reachable






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55115&edit=1


Bug #55223 [Opn->Bgs]: isset triggers fatal error when accessing object as array

2011-07-21 Thread dsp
Edit report at https://bugs.php.net/bug.php?id=55223&edit=1

 ID: 55223
 Updated by: d...@php.net
 Reported by:Sjon at hortensius dot net
 Summary:isset triggers fatal error when accessing object as
 array
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Arrays related
 Operating System:   Archlinux
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 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




Previous Comments:

[2011-07-20 16:07:14] binarycleric at gmail dot com

It's not isset that's triggering this error.  The reason is that "$x['a']" is 
not 
valid when $x is an object.

Just for (cheap and lazy) regression purposes I tried this on PHP 5.2.17 and 
the 
same thing occurred so I don't think #53971 had anything to do with it.


[2011-07-18 04:09:18] Sjon at hortensius dot net

Description:

This worked for quite a long time, but stopped working recently, I suspect due 
to 
#53971 being fixed. I think isset should never trigger any error

Test script:
---
$x = new stdClass;
$x->a = 'b';
var_dump(isset($x['a']));

Expected result:

false

Actual result:
--
PHP Fatal error:  Cannot use object of type stdClass as array in php shell code 
on line 1






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55223&edit=1


Bug #55254 [Opn->Bgs]: strpos() performs more poorly when offset specified

2011-07-21 Thread dsp
Edit report at https://bugs.php.net/bug.php?id=55254&edit=1

 ID: 55254
 Updated by: d...@php.net
 Reported by:webmaster at thedigitalorchard dot ca
 Summary:strpos() performs more poorly when offset specified
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Performance problem
 Operating System:   OS X 10.6.8
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 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

it's related to parameter passing.


Previous Comments:

[2011-07-20 19:42:49] webmaster at thedigitalorchard dot ca

This issue that I've observed may in fact not be related to strpos() at all, 
but 
merely the fact that there's one more parameter to parse. Passing in zero "0" 
as 
the third parameter gives the same result as any other offset. Removing the 
parameter restores the performance.

In a way, this makes sense, but maybe this highlights an area where PHP/Zend 
can 
be improved further -- parameter parsing.

Feel free to close this bug report if my assessment of this performance issue 
is 
accurate.


[2011-07-20 18:37:52] webmaster at thedigitalorchard dot ca

Changed summary title to be more clear (replaced "index" with "offset")


[2011-07-20 18:13:46] webmaster at thedigitalorchard dot ca

Description:

When strpos() is given an index position to start searching, it actually 
performs 
more poorly than when the parameter is left off (thus defaulting to "0"). One 
would expect that giving it a starting index would improve performance since it 
could skip checking so many characters.

I've been able to reproduce this issue consistently with the attached script.

Two loops, each run 1 million times. The first loop specifies a start index of 
2, 
whereas the second one doesn't specify one. You would expect the first loop to 
run 
faster. Try reversing this (giving the second loop a start index) and you will 
see 
the execution time results flip, as well.

My framework makes heavy use of strpos() and I discovered this issue when I 
attempted to optimize strpos() by skipping the first few characters of the 
string 
to be checked. No go.

Test script:
---
Seconds: ".(microtime(TRUE) - $start).'';

$start = microtime(TRUE);

for ($i = 0; $i < 100; $i++) {
strpos($k, '{');
}

echo "Seconds: ".(microtime(TRUE) - $start).'';

Expected result:

Specifying a start index would result in better performance since it has less 
to 
check.

Actual result:
--
Specifying a start index actually has a negative impact on the performance of 
the 
script, possibly due to logic where it must check if the index is positive or 
negative.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55254&edit=1


Bug #52144 [Com]: Error: Base lambda function for closure not found

2011-07-21 Thread aequasi at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=52144&edit=1

 ID: 52144
 Comment by: aequasi at gmail dot com
 Reported by:taco at procurios dot nl
 Summary:Error: Base lambda function for closure not found
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   linux
 PHP Version:5.3.2
 Block user comment: N
 Private report: N

 New Comment:

Has this problem been resolved yet? having the same issues when i implement APC 
with symfony2


Previous Comments:

[2011-06-06 20:04:24] nicolas at netlog dot com

Hi there,

We're experiencing the same problem here at Netlog. Also on production servers 
when we have some load. Unable to isolate this issue yet. We're running php 
5.3.5 
and apc 3.1.9. If we disable APC the problem goes away.

Any clues here?


[2010-11-05 08:27:47] janne dot hietamaki at gmail dot com

Updated to APC 3.1.5 and the problem still persists.


[2010-11-05 08:14:07] janne dot hietamaki at gmail dot com

I'm seeing this error quite often on our production servers. 

The problem seems to have something to do with APC cache, and after updating 
the files or apc_clear_cache() some random anonymous function call breaks at 
somewhere on our code.

I can reproduce the error on our production server almost every time, but I 
have not yet been able to build a reproducible test case. It seems to be a 
concurrency issue, so the reproduction most probably 
requires concurrent APC cache clearing and lambda function calls.

We're running PHP 5.3.3 with APC 3.1.4 on RHEL. I could try to upgrade to APC 
3.1.5 next.


Any help would be appreciated.


[2010-06-22 15:26:55] taco at procurios dot nl

The code in which the problem occurred looks like:

 function (&$v)
  {
if (!empty($v)) {
  $v /= 13.66;
}
return true;
  },
// ...some other lambda functions
);
// ...code that uses the array with lambda functions
?>

The error occurs at the definition of the first lambda function in the array. 
The problem is that the error isn't reproducable (at least not when I want it 
to be). That's why I'd like to know what the typical situation is in which this 
error could occur.


[2010-06-22 15:09:52] johan...@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

Please also ensure that you're having no Zend extension or opcode cache or 
similar loaded.




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

https://bugs.php.net/bug.php?id=52144


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=52144&edit=1


Bug #55252 [Opn->Dup]: On 64 bit strtotime() mishandles all-zero timestamps

2011-07-21 Thread aharvey
Edit report at https://bugs.php.net/bug.php?id=55252&edit=1

 ID: 55252
 Updated by: ahar...@php.net
 Reported by:cm at fuf dot de
 Summary:On 64 bit strtotime() mishandles all-zero timestamps
-Status: Open
+Status: Duplicate
 Type:   Bug
 Package:Date/time related
 Operating System:   Linux 2.6.38 amd64
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

This is completely valid, per strtotime()'s documented behaviour: invalid 
components within date strings are conformed as best as they can be, and in 
that 
case, you've basically asked for the last day in November in the year -1 
(effectively 2 BC).

Closing duplicate, as this has previously been dealt with in bug #53662.


Previous Comments:

[2011-07-20 11:35:53] cm at fuf dot de

Description:

The behavior of strtotime() on 64 bit machines (see below) for all-zero 
timestamps is undesirable.  On 32 bit machines the function outputs NULL for a 
string input "-00-00 00:00", on 64 bit machines it yields -62169987600.  
This is undesirable, as the all-zero timestamp is not a valid date ("00" is not 
a month). On 64 bit systems strtotime() should return NULL for "-00-00 
00:00".


Test script:
---
/* Linux ubuntu64-vbox 2.6.38-8-server #42-Ubuntu SMP Mon Apr 11 03:49:04 UTC 
 * 2011 x86_64 x86_64 x86_64 GNU/Linux
 * PHP 5.3.6-6~dotdeb.1 with Suhosin-Patch (cli) (built: Apr  3 2011 16:36:05) 
 */



Actual result:
--
-62169987600






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55252&edit=1


Bug #55260 [Opn->Bgs]: parse_ini_file breaks with ampersand

2011-07-21 Thread aharvey
Edit report at https://bugs.php.net/bug.php?id=55260&edit=1

 ID: 55260
 Updated by: ahar...@php.net
 Reported by:austinb at inn-soft dot com
 Summary:parse_ini_file breaks with ampersand
-Status: Open
+Status: Bogus
 Type:   Bug
-Package:Unknown/Other Function
+Package:Filesystem function related
 Operating System:   ubuntu4.9
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

INI comments start with a semi-colon (;), not //. As a result, that line gets 
parsed like any other INI directive, and it's an invalid one, hence the error.


Previous Comments:

[2011-07-21 11:48:22] austinb at inn-soft dot com

Description:

With an ampersand in the commented section of code, it crashes the function, 
always returns false.

Test script:
---
INI FILE
//-- SETUP FEE, INCLUDES LICENSE FOR HBP & TIME TO INSTALL IT
setupFee="79.99";

PHP
var_dump(parse_ini_file('./packageInfo.ini'));

RETURN
bool(false)

INI FILE
//-- SETUP FEE, INCLUDES LICENSE FOR HBP AND TIME TO INSTALL IT
setupFee="79.99";

PHP
var_dump(parse_ini_file('./packageInfo.ini'));

RETURN
array(1) { ["setupFee"]=> string(5) "79.99" }







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55260&edit=1


[PHP-BUG] Req #55261 [NEW]: Tokenize multiple strings in parallel is impossible using strtok

2011-07-21 Thread antonio dot bonifati at gmail dot com
From: 
Operating system: 
PHP version:  Irrelevant
Package:  Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:Tokenize multiple strings in parallel is impossible using strtok

Description:

Hi there,
I have some very long strings (they come from a MySQL query selecting
multiple 
GROUP_CONCAT-enated fields) that I would like to tokenize quickly using the

strtok function, but I cannot do that in parallel as I need. That is
fetching 
the first token from all strings, then the second token, etc.

E.g. given:

$a = '1,2,3,4';
$b = 'a,b,c,d';

strtok($a, ',') returns the first token of $a. If I then do strtok($b, ',')

it will return the first token of $b, so I have '1' and 'a' together for
the 
first iteration. In the next iteration I would need '2' and 'b', etc, but 
strtok(',') will only give me 'b', there is no way to fetch '2' from $a,
since 
strtok can only be used on one string at a time.

I know I could do it implementing my own algorithm that accesses strings 
character by character, but that would be slow. I have tried using
explode(',', 
$a/$b) but that uses too much memory, since it generates very big
intermediate 
arrays, my strings are very long and numerous.

Would it be possible to have a tokenizer facility that does not 
store the string to tokenize, but only the index of the last processed 
character, so that it can be used on multiple strings?

I know that maybe I shouldn't use PHP for such tasks but rather code in C,
but 
PHP is so quick to develop with that I cannot resist :)

I understand that strtok has been engineered this way to avoid passing the

string over and over, which would be slow for long strings due to pass by
value, 
therefore I would like to have another tokenizer function that accepts a 
reference to a string and always two arguments.


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



Bug #55021 [Bgs]: Multiple bug on variable variable error parse/comportement

2011-07-21 Thread dev at meta-gen dot com
Edit report at https://bugs.php.net/bug.php?id=55021&edit=1

 ID: 55021
 User updated by:dev at meta-gen dot com
 Reported by:dev at meta-gen dot com
 Summary:Multiple bug on variable variable error
 parse/comportement
 Status: Bogus
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Debian lenny/SID
 PHP Version:5.3SVN-2011-06-09 (snap)
 Block user comment: N
 Private report: N

 New Comment:

Yes i see $b[$k] not evaluate, 
sure it's ambiguous notation like $this->$b work;

Im sorry for a bad repport post.

I appreciate the attention, especially rasmus.


Previous Comments:

[2011-07-21 11:46:18] ras...@php.net

You are a bit confused. Forget all the class stuff. 
Just look at:
$b='a';
echo $b['key'];

You will see that prints: a

That's because $b is a string and not an array and therefore only takes integer 
offsets. (int)'key' is 0, so your code is the same as doing $b[0] which means 
you will never see 'key' in your result and also since it isn't an array you 
can't append to it with [].


[2011-07-21 09:25:59] dev at meta-gen dot com

Hello,

Sorry perhaps i not good explain,

I found TWO bug.

The first is in function 'fn'
I try add a value in $this->a by variable variable
like this : 

class C
{
public $a = array();

public function fn()
{
$b = 'a';
$this->$b['key'] = 'foo';
return $this->a;
}
}
$C = new C;
var_dump($C->fn());

This code return string(3) "foo". IS BAD RESULT

Normaly GOOD result for fn must be array(1) { ["key"]=> string(3) "foo" } 
because $this->$b == $this->a



AND second bug is in fn3
class C
{
public $a = array();
public function fn3()
{
$b = 'a';
$this->$b['key'][] = 'foo'; ///BUG Error parse : PHP Fatal 
error:  Cannot use [] for reading in  
return $this->a;
}
}
$C = new C;
var_dump($C->fn3());

This code cause Error parse : PHP Fatal error:  Cannot use [] for reading in 
 
when it should return array(1) { ["key"]=> array(1) { [0]=> string(3) "foo" } }

because $this->$b['key'][] == $this->a['key'][]

Salutation.


[2011-07-20 23:24:33] binarycleric at gmail dot com

I looked into this for a bit and I must say I was a bit confused until the 
answer smacked me in the face.

The 'fn3' method isn't doing what you think it's doing.  Upon glancing at the 
code it may appear that $this-
>a['first'] is having the value 'foo' appended to it (which doesn't make sense 
because $this->a['first'] is 
a string, not an array).

What is actually happening (according to my tests on PHP 5.2.17) is that $b[$k]
[] is being evaluated first 
and then the result is being used at the property name, which explains the 
"Cannot use [] for reading" 
error.

Assuming your test code was changed and $this->a['first'] was an array, the 
"slightly more correct" way 
would be to call $this->{$b}[$k][] which would evaluate to $this->a['first'][].

In my opinion this should be classified as "not a bug".


[2011-06-10 02:07:09] dev at meta-gen dot com

Description:

When use variable variable with property array in class, a multipe bug occur.

On function exemple fn, variable variable cast in string


On function exemple fn3, parse error 'Cannot use [] for reading in'

Test script:
---
class C
{
public $a = array('first' => 'baz');

/**
 * It's work but $this->a is cast in string and override array
 * @note $this->a : string(3) "foo" 
 */
public function fn($k)
{
$b = 'a';
$this->$b[$k] = 'foo';
}

/**
 * Normaly use
 * @note Similar result of fn
 * @note $this->a : string(3) "foo"
 */
public function fn2($k)
{
$b = 'a';
$this->$b = 'foo';
}

/**
 * This case is most interesting, because as it run parse error
 * @note don't parse $this->$b
 */
public function fn3($k)
{
$b = 'a';
$this->$b[$k][] = 'foo'; ///BUG Error parse : PHP Fatal error:  
Cannot use [] for reading in  
}

/**
 * Solution for fix fn3
 */
public function fn4($k)
{
$b = 'a';
$tmp =& $this->$b;
$tmp[$k][] = 'foo';
}
}


Expected result:

for function fn('key') : array('first' => 'baz', 'key' => 'foo')


for function fn3('key') :

array(2) {
  ["first"]=>
  s

[PHP-BUG] Bug #55260 [NEW]: parse_ini_file breaks with ampersand

2011-07-21 Thread austinb at inn-soft dot com
From: 
Operating system: ubuntu4.9
PHP version:  Irrelevant
Package:  Unknown/Other Function
Bug Type: Bug
Bug description:parse_ini_file breaks with ampersand

Description:

With an ampersand in the commented section of code, it crashes the
function, 
always returns false.

Test script:
---
INI FILE
//-- SETUP FEE, INCLUDES LICENSE FOR HBP & TIME TO INSTALL IT
setupFee="79.99";

PHP
var_dump(parse_ini_file('./packageInfo.ini'));

RETURN
bool(false)

INI FILE
//-- SETUP FEE, INCLUDES LICENSE FOR HBP AND TIME TO INSTALL IT
setupFee="79.99";

PHP
var_dump(parse_ini_file('./packageInfo.ini'));

RETURN
array(1) { ["setupFee"]=> string(5) "79.99" }


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



Bug #55021 [Opn->Bgs]: Multiple bug on variable variable error parse/comportement

2011-07-21 Thread rasmus
Edit report at https://bugs.php.net/bug.php?id=55021&edit=1

 ID: 55021
 Updated by: ras...@php.net
 Reported by:dev at meta-gen dot com
 Summary:Multiple bug on variable variable error
 parse/comportement
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Debian lenny/SID
 PHP Version:5.3SVN-2011-06-09 (snap)
 Block user comment: N
 Private report: N

 New Comment:

You are a bit confused. Forget all the class stuff. 
Just look at:
$b='a';
echo $b['key'];

You will see that prints: a

That's because $b is a string and not an array and therefore only takes integer 
offsets. (int)'key' is 0, so your code is the same as doing $b[0] which means 
you will never see 'key' in your result and also since it isn't an array you 
can't append to it with [].


Previous Comments:

[2011-07-21 09:25:59] dev at meta-gen dot com

Hello,

Sorry perhaps i not good explain,

I found TWO bug.

The first is in function 'fn'
I try add a value in $this->a by variable variable
like this : 

class C
{
public $a = array();

public function fn()
{
$b = 'a';
$this->$b['key'] = 'foo';
return $this->a;
}
}
$C = new C;
var_dump($C->fn());

This code return string(3) "foo". IS BAD RESULT

Normaly GOOD result for fn must be array(1) { ["key"]=> string(3) "foo" } 
because $this->$b == $this->a



AND second bug is in fn3
class C
{
public $a = array();
public function fn3()
{
$b = 'a';
$this->$b['key'][] = 'foo'; ///BUG Error parse : PHP Fatal 
error:  Cannot use [] for reading in  
return $this->a;
}
}
$C = new C;
var_dump($C->fn3());

This code cause Error parse : PHP Fatal error:  Cannot use [] for reading in 
 
when it should return array(1) { ["key"]=> array(1) { [0]=> string(3) "foo" } }

because $this->$b['key'][] == $this->a['key'][]

Salutation.


[2011-07-20 23:24:33] binarycleric at gmail dot com

I looked into this for a bit and I must say I was a bit confused until the 
answer smacked me in the face.

The 'fn3' method isn't doing what you think it's doing.  Upon glancing at the 
code it may appear that $this-
>a['first'] is having the value 'foo' appended to it (which doesn't make sense 
because $this->a['first'] is 
a string, not an array).

What is actually happening (according to my tests on PHP 5.2.17) is that $b[$k]
[] is being evaluated first 
and then the result is being used at the property name, which explains the 
"Cannot use [] for reading" 
error.

Assuming your test code was changed and $this->a['first'] was an array, the 
"slightly more correct" way 
would be to call $this->{$b}[$k][] which would evaluate to $this->a['first'][].

In my opinion this should be classified as "not a bug".


[2011-06-10 02:07:09] dev at meta-gen dot com

Description:

When use variable variable with property array in class, a multipe bug occur.

On function exemple fn, variable variable cast in string


On function exemple fn3, parse error 'Cannot use [] for reading in'

Test script:
---
class C
{
public $a = array('first' => 'baz');

/**
 * It's work but $this->a is cast in string and override array
 * @note $this->a : string(3) "foo" 
 */
public function fn($k)
{
$b = 'a';
$this->$b[$k] = 'foo';
}

/**
 * Normaly use
 * @note Similar result of fn
 * @note $this->a : string(3) "foo"
 */
public function fn2($k)
{
$b = 'a';
$this->$b = 'foo';
}

/**
 * This case is most interesting, because as it run parse error
 * @note don't parse $this->$b
 */
public function fn3($k)
{
$b = 'a';
$this->$b[$k][] = 'foo'; ///BUG Error parse : PHP Fatal error:  
Cannot use [] for reading in  
}

/**
 * Solution for fix fn3
 */
public function fn4($k)
{
$b = 'a';
$tmp =& $this->$b;
$tmp[$k][] = 'foo';
}
}


Expected result:

for function fn('key') : array('first' => 'baz', 'key' => 'foo')


for function fn3('key') :

array(2) {
  ["first"]=>
  string(3) "baz"
  ["key"]=>
  array(1) {
[0]=>
string(3) "foo"
  }
}



Actual result:
--
for function fn('key') : string(3) "foo"


for function fn3('key') : Cannot use [] for reading in...



--

Req #44331 [Csd]: Formatting option for json_encode

2011-07-21 Thread rasmus
Edit report at https://bugs.php.net/bug.php?id=44331&edit=1

 ID: 44331
 Updated by: ras...@php.net
 Reported by:jeremy at duckwizard dot com
 Summary:Formatting option for json_encode
 Status: Closed
 Type:   Feature/Change Request
 Package:JSON related
 Operating System:   Debian Stable
 PHP Version:5.2.5
 Assigned To:aharvey
 Block user comment: N
 Private report: N

 New Comment:

This is a PHP 5.4 feature.


Previous Comments:

[2011-07-21 09:04:31] joined_up_typeski at yahoo dot com

PHP Version 5.3.5-pl0-gentoo
JSON 1.2.1

passing JSON_PRETTY_PRINT to the function means that I get no output at all 
from PHP.


[2011-04-29 19:11:37] php at mjpa dot co dot uk

This has not been implemented...


[2010-09-16 18:21:59] ahar...@php.net

This bug has been fixed in SVN.

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.

The trunk version of json_encode() will now accept a JSON_PRETTY_PRINT option.


[2010-09-16 18:21:17] ahar...@php.net

Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=303425
Log: Implement FR #44331 (Formatting option for json_encode). Bikeshedding 
about the
exact form of the JSON pretty printing and brace handling will only be accepted
in the form of patches. ;)


[2009-12-08 12:05:52] pankaj dot khairnar at live dot com

yes it will be a real nice feature of json_encode function
and I am expecting it to same.




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

https://bugs.php.net/bug.php?id=44331


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=44331&edit=1


Bug #10666 [Com]: preg_replace 'e' modifier

2011-07-21 Thread raincious at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=10666&edit=1

 ID: 10666
 Comment by: raincious at gmail dot com
 Reported by:smoonen at andstuff dot org
 Summary:preg_replace 'e' modifier
 Status: Closed
 Type:   Bug
 Package:PCRE related
 Operating System:   Linux
 PHP Version:4.0.5
 Block user comment: N
 Private report: N

 New Comment:

NO, this just IS A BUG. Please fix it or add a switch to shutdown the bug, i 
don't 
need it done any other thing for me without replace then call the function.

I know someone want to be perfect, but it's overplayed. If you want to do 
everything for user, why don't just pay time for create a function php, named 
give_me_my_wanted_website();?


Previous Comments:

[2004-08-23 16:49:31] info at webprog dot de

3 Years ago its allready a feature? :-)
I build something like this:

$r = "".$words."";

$this->template = preg_replace ("/((<[^>]*)|(^| |>)($words)([^a-zA-Z]|$))/e", 
'"\\2"=="\\1"? "\\1":"\\3\\4\\5"', 
$this->template);

...and it works fine with Perl and bad with PHP, because it sets in front of 
every single quote a backslash.


[2001-08-03 12:01:46] smoonen at andstuff dot org

Strangely, while the bug referenced in my update at [2001-05-04 13:55:39] was 
very repeatable across several PHP installations, I can no longer duplicate it.

Am closing the bug, though in my dreams I still wish for $n pseudovariables. ;-)


[2001-05-04 14:36:12] smoonen at andstuff dot org

Also, as a merely informational aside, PHP's use of $1 is in this instance 
actually incompatible with Perl.  Perl, in a s///e expression, treats $n as a 
variable rather than expanding it in-place.

Hence my preference. :-)



[2001-05-04 13:55:39] smoonen at andstuff dot org

Okay.  Then I have a problem with how backslash escaping is inconsistently 
applied when using \\1 and $1.

Specifically, consider the following:

  function f($x) { print $x; }
  $s = "a' \\ \"b";
  $s = preg_replace('/a(.*)b/e', 'f("$1")', $s, -1);

The single quote is escaped; I'd rather it weren't but that's okay.  But the 
backslash itself isn't escaped!  This prevents me from running stripslashes() 
on the match, since I can't guarantee that every backslash has been properly 
escaped.

Worse, the following will actually fail:

  function f($x) { print $x; }
  $s = "a' \" \\b";
  $s = preg_replace('/a(.*)b/e', 'f("$1")', $s, -1);

Since the final backslash hasn't been escaped, it actually slurps up the second 
double-quote in 'f("$1")'!

I'd like to see either of the following:

  1. $1 treated as a "real" variable, rather than a string
 substitution.  This is convenient, since it saves me
 having to call stripslashes().

  2. Backslash escapes consistently applied in backrefs.
 Specifically, escape existing backslashes in the match.
 Presently, I can't perform a stripslashes() -- and in
 some cases, as indicated above, it fails altogether!



[2001-05-04 13:02:59] and...@php.net

$n notation was introduced to be similar to Perl. It is exactly equivalent to 
\\n.

You can't simply use f($1) in the evaluation string because $1 is replaced with 
the matched contents and after replacement it becomes, in your example, f(abc 
def), which is not valid PHP code. So you have to use f("$1") or f('$1').

The fact that it backslash-escapes single and double quotes in matches before 
substituting $1 is a feature, not a bug, otherwise you'd have a really hard 
time figuring out which quotes go where when using evaluation strings.




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

https://bugs.php.net/bug.php?id=10666


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=10666&edit=1


Bug #53041 [Ver->Fbk]: is_file() and open_basedir

2011-07-21 Thread pajoye
Edit report at https://bugs.php.net/bug.php?id=53041&edit=1

 ID: 53041
 Updated by: paj...@php.net
 Reported by:sunseb at live dot com
 Summary:is_file() and open_basedir
-Status: Verified
+Status: Feedback
 Type:   Bug
 Package:*Directory/Filesystem functions
 Operating System:   Linux
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

@kev at dewsolutions dot co dot uk


Given:

dirname(__FILE__) . '/index.php/test'

I suppose that index.php is a file, right?


Previous Comments:

[2011-07-21 07:59:32] kev at dewsolutions dot co dot uk

Still occurs in PHP 5.3.6.

to replicate:
';

// append text to current directory name which should be the dir of 
open_basedir to trigger open_basedir warning
echo 'checking ' . dirname(__FILE__) . 'test ';
var_dump(file_exists(dirname(__FILE__) . 'test'));

// no warning should occur here whether index.php exists or not
echo 'checking ' . dirname(__FILE__) . '/index.php ';
var_dump(file_exists(dirname(__FILE__) . '/index.php'));

// if index.php exists a open_basedir warning will be thrown
echo 'checking ' . dirname(__FILE__) . '/index.php/test ';
var_dump(file_exists(dirname(__FILE__) . '/index.php/test'));


[2011-02-26 22:32:43] info at riastudio dot fr

Still occurs in 5.3.5, more than annoying when you have a lot of vhosts with 
open_basedir + error_reporting E_ALL


[2011-02-02 17:26:18] mjk at emmjaykay dot org

My apologies. But it says "directory: /home/my_file.txt" so I the directions 
were a little unclear. sry


[2011-02-02 12:39:14] sjon at react dot com

apart from you not reproducing the bug correctly (my_file.txt should obviously 
be a file, not a directory), this seems to have been fixed by now.

I suspect this to fix it:

http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c?r1=264931&r2=264932&;


[2011-02-01 19:06:53] mjk at emmjaykay dot org

I setup my machine as described in this bug and changed my /etc/php.ini so that 
open_basedir = /home/, mkdir /home/my_file.txt and did a touch 
/home/my_file.txt/whatever. I then ran this script



and got this

bool(false)
bool(true)

Is there another change I need to make to php.ini or something I'm missing?




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

https://bugs.php.net/bug.php?id=53041


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=53041&edit=1


Bug #55258 [Opn->Csd]: Windows Version Detecting Error

2011-07-21 Thread pajoye
Edit report at https://bugs.php.net/bug.php?id=55258&edit=1

 ID: 55258
 Updated by: paj...@php.net
 Reported by:xiaomao5 at live dot com
 Summary:Windows Version Detecting Error
-Status: Open
+Status: Closed
 Type:   Bug
 Package:Unknown/Other Function
 Operating System:   Windows
 PHP Version:5.3SVN-2011-07-21 (SVN)
-Assigned To:
+Assigned To:pajoye
 Block user comment: N
 Private report: N

 New Comment:

This bug has been fixed in SVN.

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

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Thanks for the report and patch, forgot to merge that fix in 5.3 back then.


Previous Comments:

[2011-07-21 10:49:49] paj...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=313538
Log: - Fixed bug #55258 (Windows Version Detecting Error) (already fixed in 
trunk/5.4)


[2011-07-21 09:31:14] xiaomao5 at live dot com

Although the patch is generated from the older version, the bug still exists in 
branches/PHP_5_3.


[2011-07-21 09:28:37] xiaomao5 at live dot com

Description:

In PHP 5.3, and of course all version before it, Windows 7 is detected as 6.2, 
which would be Windows 8, which isn't released. So Windows 7, as 6.1 will turn 
into Unknow Windows version.(It's also should be Unknown, not Unknow).

Test script:
---
https://bugs.php.net/bug.php?id=55258&edit=1


[PHP-BUG] Bug #55259 [NEW]: penssl extension does not get the DH parameters from DH key resource

2011-07-21 Thread peter at vereshagin dot org
From: 
Operating system: freebsd-7.4
PHP version:  5.3.6
Package:  OpenSSL related
Bug Type: Bug
Bug description:penssl extension does not get the DH parameters from DH key 
resource

Description:

This is the same for lang/php5 port as of 5.3.6_1 and for the SVN version
as of:
===
Path: .
URL: https://svn.php.net/repository/php/php-src/branches/PHP_5_3
Repository Root: https://svn.php.net/repository
Repository UUID: c90b9560-bf6c-de11-be94-00142212c4b1
Revision: 313330
Node Kind: directory
Schedule: normal
Last Changed Author: stas
Last Changed Rev: 313316
Last Changed Date: 2011-07-17 11:03:19 +0400 (Sun, 17 Jul 2011)
===
I had rebuilt the security/php5-openssl port, too with these svn sources
rewriting from them with 'rsync -rlcC' right after the 'make extract'.
Current workaround is to disable the openssl extension and use a different
extension for diffie-hellman algorithm
Below is the 'php -i' output:
===
PHP Version 5.3.7RC4-dev


System  FreeBSD teh.ost 7.4-STABLE FreeBSD 7.4-STABLE #10: Mon May 2
16:12:55 MSD 2011
pe...@vereshagin.org:/usr/local/obj/usr/local/src/sys/JUICY i386
Build Date  Jul 21 2011 16:18:28
Configure Command'./configure' '--with-layout=GNU' 
'--localstatedir=/var'
'--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all'
'--enable-libxml' '--with-libxml-dir=/usr/local'
'--with-pcre-regex=/usr/local' '--with-zlib-dir=/usr' '--program-prefix='
'--disable-cli' '--enable-embed=shared' '--enable-fpm'
'--with-fpm-user=www' '--with-fpm-group=www' '--with-regex=php'
'--with-zend-vm=CALL' '--enable-debug' '--enable-zend-multibyte'
'--prefix=/usr/local' '--mandir=/usr/local/man'
'--infodir=/usr/local/info/' '--build=i386-portbld-freebsd7.4'
Server API  FPM/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /usr/local/etc
Loaded Configuration File   /usr/local/etc/php.ini
Scan this dir for additional .ini files /usr/local/etc/php
Additional .ini files parsed/usr/local/etc/php/extensions.ini
PHP API 20090626
PHP Extension   20090626
Zend Extension  220090626
Zend Extension BuildAPI220090626,NTS,debug
PHP Extension Build API20090626,NTS,debug
Debug Build yes
Thread Safety   disabled
Zend Memory Manager enabled
Zend Multibyte Support  enabled
IPv6 Supportenabled
Registered PHP Streams  php, file, glob, data, http, ftp, compress.zlib,
compress.bzip2, zip, https, ftps
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2,
tls
Registered Stream Filters   string.rot13, string.toupper, string.tolower,
string.strip_tags, convert.*, consumed, dechunk, zlib.*, bzip2.*,
convert.iconv.*, mcrypt.*, mdecrypt.*

This server is protected with the Suhosin Patch 0.9.10
Copyright (c) 2006-2007 Hardened-PHP Project Copyright (c) 2007-2011
SektionEins GmbH

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

PHP Credits

Configuration

bcmath

BCMath support  enabled

Directive   Local Value Master Value
bcmath.scale0   0

bz2

BZip2 Support   Enabled
Stream Wrapper support  compress.bzip2://
Stream Filter support   bzip2.decompress, bzip2.compress
BZip2 Version   1.0.5, 10-Dec-2007

calendar

Calendar supportenabled

cgi-fcgi

php-fpm active

Directive   Local Value Master Value
cgi.discard_path0   0
cgi.fix_pathinfo1   1
cgi.force_redirect  1   1
cgi.nph 0   0
cgi.redirect_status_env no valueno value
cgi.rfc2616_headers 0   0
fastcgi.error_headerno valueno value
fastcgi.logging 1   1
fpm.config  no valueno value

Core

PHP Version 5.3.7RC4-dev

Directive   Local Value Master Value
allow_call_time_pass_reference  On  On
allow_url_fopen On  On
allow_url_include   Off Off
always_populate_raw_post_data   Off Off
arg_separator.input &   &
arg_separator.output&   &
asp_tagsOff Off
auto_append_fileno valueno value
auto_globals_jitOn  On
auto_prepend_file   no valueno value
browscapno valueno value
default_charset no valueno value
default_mimetypetext/html   text/html
define_syslog_variables Off Off
detect_unicode  On  On
disable_classes no valueno value
disable_functions   no valueno value
display_errors  On  On
display_startup_errors  Off Off
doc_rootno valueno value
docref_ext  no valueno value
docref_root no valueno value
enable_dl   On  On
error_append_string no valueno value
error_log   /tmp/php.log/tmp/php.log
error_prepend_stringno valueno value
error_reporting 30719   30719
exit_on_timeout Off Off
expose_php  On  On
extension_dir   /usr/local/lib/php/20090626-debug   
/usr/local/lib/php/20090626-de

Bug #55258 [Opn]: Windows Version Detecting Error

2011-07-21 Thread xiaomao5 at live dot com
Edit report at https://bugs.php.net/bug.php?id=55258&edit=1

 ID: 55258
 User updated by:xiaomao5 at live dot com
 Reported by:xiaomao5 at live dot com
 Summary:Windows Version Detecting Error
 Status: Open
 Type:   Bug
 Package:Unknown/Other Function
 Operating System:   Windows
 PHP Version:5.3SVN-2011-07-21 (SVN)
 Block user comment: N
 Private report: N

 New Comment:

Although the patch is generated from the older version, the bug still exists in 
branches/PHP_5_3.


Previous Comments:

[2011-07-21 09:28:37] xiaomao5 at live dot com

Description:

In PHP 5.3, and of course all version before it, Windows 7 is detected as 6.2, 
which would be Windows 8, which isn't released. So Windows 7, as 6.1 will turn 
into Unknow Windows version.(It's also should be Unknown, not Unknow).

Test script:
---
https://bugs.php.net/bug.php?id=55258&edit=1


[PHP-BUG] Bug #55258 [NEW]: Windows Version Detecting Error

2011-07-21 Thread xiaomao5 at live dot com
From: 
Operating system: Windows
PHP version:  5.3SVN-2011-07-21 (SVN)
Package:  Unknown/Other Function
Bug Type: Bug
Bug description:Windows Version Detecting Error

Description:

In PHP 5.3, and of course all version before it, Windows 7 is detected as
6.2, which would be Windows 8, which isn't released. So Windows 7, as 6.1
will turn into Unknow Windows version.(It's also should be Unknown, not
Unknow).

Test script:
---
https://bugs.php.net/bug.php?id=55258&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55258&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55258&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55258&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55258&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55258&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55258&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55258&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55258&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55258&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55258&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55258&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55258&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55258&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55258&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55258&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55258&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55258&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55258&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55258&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55258&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55258&r=mysqlcfg



Req #51939 [PATCH]: Add xml_set_entity_decl_handler function

2011-07-21 Thread dav...@php.net
Edit report at https://bugs.php.net/bug.php?id=51939&edit=1

 ID: 51939
 Patch added by: dav...@php.net
 Reported by:mchenryc at gmail dot com
 Summary:Add xml_set_entity_decl_handler function
 Status: Assigned
 Type:   Feature/Change Request
 Package:XML related
 PHP Version:trunk-SVN-2010-05-28 (SVN)
 Assigned To:davidc
 Block user comment: N
 Private report: N

 New Comment:

The following patch has been added/updated:

Patch Name: Bug51939.patch
Revision:   1311253426
URL:
https://bugs.php.net/patch-display.php?bug=51939&patch=Bug51939.patch&revision=1311253426


Previous Comments:

[2011-07-21 08:43:50] dav...@php.net

The following patch has been added/updated:

Patch Name: bug51939-3-ws.patch
Revision:   1311252230
URL:
https://bugs.php.net/patch-display.php?bug=51939&patch=bug51939-3-ws.patch&revision=1311252230


[2011-07-21 08:39:38] dav...@php.net

The following patch has been added/updated:

Patch Name: bug51392-ws
Revision:   1311251978
URL:
https://bugs.php.net/patch-display.php?bug=51939&patch=bug51392-ws&revision=1311251978


[2011-07-19 12:22:21] dav...@php.net

I've added a patch for this but I'd like to write a few more tests before 
committing it. If you could apply it and let me know if this helps you that'd 
be 
nice.


[2011-07-19 12:21:20] dav...@php.net

The following patch has been added/updated:

Patch Name: bug51939.patch
Revision:   1311092480
URL:
https://bugs.php.net/patch-display.php?bug=51939&patch=bug51939.patch&revision=1311092480


[2010-05-28 01:40:45] mchenryc at gmail dot com

Description:

When parsing XML, PHP has no way to set a handler for general entities, though 
a 
handler can be set for unparsed entities.

Expat has deprecated the XML_SetUnparsedEntityDeclHandler in favor of 
XML_SetEntityDeclHandler, which is called for all entity types (including 
general 
and unparsed).

http://expat.cvs.sourceforge.net/viewvc/expat/expat/lib/expat.h?
revision=1.80&view=markup#l_311

PHP should add the xml_set_entity_decl_handler function to allow handling of 
all 
entity declarations.


Test script:
---
$data = ']>&generalEntity;';

function 
h_entity_decl($parser,$entity_name,$is_parameter_entity,$value,$base,$system_id,$public_id,$notation_name)
 {
echo "$entity_name - $is_parameter_entity - $value";
};

$parser = xml_parser_create();
xml_set_entity_decl_handler($parser, 'h_entity_decl');

xml_parse($parser,$data,false) or 
die (sprintf("XML Error: %s at line %d\n", 
 xml_error_string(xml_get_error_code($parser)),
 xml_get_current_line_number($parser)));
xml_parser_free($parser);


Expected result:

It should run with the following output:

generalEntity - 0 - General Entity


Actual result:
--
Fatal Error: Call to undefined function xml_set_entity_decl_handler()







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=51939&edit=1


Req #44331 [Com]: Formatting option for json_encode

2011-07-21 Thread joined_up_typeski at yahoo dot com
Edit report at https://bugs.php.net/bug.php?id=44331&edit=1

 ID: 44331
 Comment by: joined_up_typeski at yahoo dot com
 Reported by:jeremy at duckwizard dot com
 Summary:Formatting option for json_encode
 Status: Closed
 Type:   Feature/Change Request
 Package:JSON related
 Operating System:   Debian Stable
 PHP Version:5.2.5
 Assigned To:aharvey
 Block user comment: N
 Private report: N

 New Comment:

PHP Version 5.3.5-pl0-gentoo
JSON 1.2.1

passing JSON_PRETTY_PRINT to the function means that I get no output at all 
from PHP.


Previous Comments:

[2011-04-29 19:11:37] php at mjpa dot co dot uk

This has not been implemented...


[2010-09-16 18:21:59] ahar...@php.net

This bug has been fixed in SVN.

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.

The trunk version of json_encode() will now accept a JSON_PRETTY_PRINT option.


[2010-09-16 18:21:17] ahar...@php.net

Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=303425
Log: Implement FR #44331 (Formatting option for json_encode). Bikeshedding 
about the
exact form of the JSON pretty printing and brace handling will only be accepted
in the form of patches. ;)


[2009-12-08 12:05:52] pankaj dot khairnar at live dot com

yes it will be a real nice feature of json_encode function
and I am expecting it to same.


[2008-03-04 20:05:37] jeremy at duckwizard dot com

Description:

One of the appeals of JSON is that it is human readable.  However, json_encode 
produces output that is not particularly manageable by a human - little more so 
than PHP's own serialization.  DOM, for example, has a formatOutput option that 
nicely indents the resulting XML.  A similar option for json_encode would be 
extremely helpful.

Reproduce code:
---
$obj = new stdClass;
$obj->field1 = "hello";
$obj->field2 = "world";
$obj->field3 = array("key" => "value", "level2" => array(1,2,3));
echo json_encode($obj, JSON::FORMAT_OUTPUT);

//flags are an implementation example

Expected result:

{
"field1":"hello",
"field2":"world",
"field3":
{
"key":"value",
"level2": [1,2,3]
}
}

Actual result:
--
{"field1":"hello","field2":"world","field3":{"key":"value","level2":[1,2,3]}}






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=44331&edit=1


[PHP-BUG] Req #55257 [NEW]: Interactive Shell on Windows

2011-07-21 Thread xiaomao5 at live dot com
From: 
Operating system: Windows
PHP version:  Irrelevant
Package:  Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:Interactive Shell on Windows

Description:

I know Windows doesn't have readline support, but that won't stop an
interactive shell. Windows have built-in command line history and editing
in the console.

Try this:
open php without arguments on windows, type in some word and press enter,
then press the up arrow. The text you type in will come back.


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



Bug #55021 [Opn]: Multiple bug on variable variable error parse/comportement

2011-07-21 Thread dev at meta-gen dot com
Edit report at https://bugs.php.net/bug.php?id=55021&edit=1

 ID: 55021
 User updated by:dev at meta-gen dot com
 Reported by:dev at meta-gen dot com
 Summary:Multiple bug on variable variable error
 parse/comportement
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Debian lenny/SID
 PHP Version:5.3SVN-2011-06-09 (snap)
 Block user comment: N
 Private report: N

 New Comment:

Hello,

Sorry perhaps i not good explain,

I found TWO bug.

The first is in function 'fn'
I try add a value in $this->a by variable variable
like this : 

class C
{
public $a = array();

public function fn()
{
$b = 'a';
$this->$b['key'] = 'foo';
return $this->a;
}
}
$C = new C;
var_dump($C->fn());

This code return string(3) "foo". IS BAD RESULT

Normaly GOOD result for fn must be array(1) { ["key"]=> string(3) "foo" } 
because $this->$b == $this->a



AND second bug is in fn3
class C
{
public $a = array();
public function fn3()
{
$b = 'a';
$this->$b['key'][] = 'foo'; ///BUG Error parse : PHP Fatal 
error:  Cannot use [] for reading in  
return $this->a;
}
}
$C = new C;
var_dump($C->fn3());

This code cause Error parse : PHP Fatal error:  Cannot use [] for reading in 
 
when it should return array(1) { ["key"]=> array(1) { [0]=> string(3) "foo" } }

because $this->$b['key'][] == $this->a['key'][]

Salutation.


Previous Comments:

[2011-07-20 23:24:33] binarycleric at gmail dot com

I looked into this for a bit and I must say I was a bit confused until the 
answer smacked me in the face.

The 'fn3' method isn't doing what you think it's doing.  Upon glancing at the 
code it may appear that $this-
>a['first'] is having the value 'foo' appended to it (which doesn't make sense 
because $this->a['first'] is 
a string, not an array).

What is actually happening (according to my tests on PHP 5.2.17) is that $b[$k]
[] is being evaluated first 
and then the result is being used at the property name, which explains the 
"Cannot use [] for reading" 
error.

Assuming your test code was changed and $this->a['first'] was an array, the 
"slightly more correct" way 
would be to call $this->{$b}[$k][] which would evaluate to $this->a['first'][].

In my opinion this should be classified as "not a bug".


[2011-06-10 02:07:09] dev at meta-gen dot com

Description:

When use variable variable with property array in class, a multipe bug occur.

On function exemple fn, variable variable cast in string


On function exemple fn3, parse error 'Cannot use [] for reading in'

Test script:
---
class C
{
public $a = array('first' => 'baz');

/**
 * It's work but $this->a is cast in string and override array
 * @note $this->a : string(3) "foo" 
 */
public function fn($k)
{
$b = 'a';
$this->$b[$k] = 'foo';
}

/**
 * Normaly use
 * @note Similar result of fn
 * @note $this->a : string(3) "foo"
 */
public function fn2($k)
{
$b = 'a';
$this->$b = 'foo';
}

/**
 * This case is most interesting, because as it run parse error
 * @note don't parse $this->$b
 */
public function fn3($k)
{
$b = 'a';
$this->$b[$k][] = 'foo'; ///BUG Error parse : PHP Fatal error:  
Cannot use [] for reading in  
}

/**
 * Solution for fix fn3
 */
public function fn4($k)
{
$b = 'a';
$tmp =& $this->$b;
$tmp[$k][] = 'foo';
}
}


Expected result:

for function fn('key') : array('first' => 'baz', 'key' => 'foo')


for function fn3('key') :

array(2) {
  ["first"]=>
  string(3) "baz"
  ["key"]=>
  array(1) {
[0]=>
string(3) "foo"
  }
}



Actual result:
--
for function fn('key') : string(3) "foo"


for function fn3('key') : Cannot use [] for reading in...







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55021&edit=1


Req #51939 [PATCH]: Add xml_set_entity_decl_handler function

2011-07-21 Thread dav...@php.net
Edit report at https://bugs.php.net/bug.php?id=51939&edit=1

 ID: 51939
 Patch added by: dav...@php.net
 Reported by:mchenryc at gmail dot com
 Summary:Add xml_set_entity_decl_handler function
 Status: Assigned
 Type:   Feature/Change Request
 Package:XML related
 PHP Version:trunk-SVN-2010-05-28 (SVN)
 Assigned To:davidc
 Block user comment: N
 Private report: N

 New Comment:

The following patch has been added/updated:

Patch Name: bug51939-3-ws.patch
Revision:   1311252230
URL:
https://bugs.php.net/patch-display.php?bug=51939&patch=bug51939-3-ws.patch&revision=1311252230


Previous Comments:

[2011-07-21 08:39:38] dav...@php.net

The following patch has been added/updated:

Patch Name: bug51392-ws
Revision:   1311251978
URL:
https://bugs.php.net/patch-display.php?bug=51939&patch=bug51392-ws&revision=1311251978


[2011-07-19 12:22:21] dav...@php.net

I've added a patch for this but I'd like to write a few more tests before 
committing it. If you could apply it and let me know if this helps you that'd 
be 
nice.


[2011-07-19 12:21:20] dav...@php.net

The following patch has been added/updated:

Patch Name: bug51939.patch
Revision:   1311092480
URL:
https://bugs.php.net/patch-display.php?bug=51939&patch=bug51939.patch&revision=1311092480


[2010-05-28 01:40:45] mchenryc at gmail dot com

Description:

When parsing XML, PHP has no way to set a handler for general entities, though 
a 
handler can be set for unparsed entities.

Expat has deprecated the XML_SetUnparsedEntityDeclHandler in favor of 
XML_SetEntityDeclHandler, which is called for all entity types (including 
general 
and unparsed).

http://expat.cvs.sourceforge.net/viewvc/expat/expat/lib/expat.h?
revision=1.80&view=markup#l_311

PHP should add the xml_set_entity_decl_handler function to allow handling of 
all 
entity declarations.


Test script:
---
$data = ']>&generalEntity;';

function 
h_entity_decl($parser,$entity_name,$is_parameter_entity,$value,$base,$system_id,$public_id,$notation_name)
 {
echo "$entity_name - $is_parameter_entity - $value";
};

$parser = xml_parser_create();
xml_set_entity_decl_handler($parser, 'h_entity_decl');

xml_parse($parser,$data,false) or 
die (sprintf("XML Error: %s at line %d\n", 
 xml_error_string(xml_get_error_code($parser)),
 xml_get_current_line_number($parser)));
xml_parser_free($parser);


Expected result:

It should run with the following output:

generalEntity - 0 - General Entity


Actual result:
--
Fatal Error: Call to undefined function xml_set_entity_decl_handler()







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=51939&edit=1


Req #51939 [PATCH]: Add xml_set_entity_decl_handler function

2011-07-21 Thread dav...@php.net
Edit report at https://bugs.php.net/bug.php?id=51939&edit=1

 ID: 51939
 Patch added by: dav...@php.net
 Reported by:mchenryc at gmail dot com
 Summary:Add xml_set_entity_decl_handler function
 Status: Assigned
 Type:   Feature/Change Request
 Package:XML related
 PHP Version:trunk-SVN-2010-05-28 (SVN)
 Assigned To:davidc
 Block user comment: N
 Private report: N

 New Comment:

The following patch has been added/updated:

Patch Name: bug51392-ws
Revision:   1311251978
URL:
https://bugs.php.net/patch-display.php?bug=51939&patch=bug51392-ws&revision=1311251978


Previous Comments:

[2011-07-19 12:22:21] dav...@php.net

I've added a patch for this but I'd like to write a few more tests before 
committing it. If you could apply it and let me know if this helps you that'd 
be 
nice.


[2011-07-19 12:21:20] dav...@php.net

The following patch has been added/updated:

Patch Name: bug51939.patch
Revision:   1311092480
URL:
https://bugs.php.net/patch-display.php?bug=51939&patch=bug51939.patch&revision=1311092480


[2010-05-28 01:40:45] mchenryc at gmail dot com

Description:

When parsing XML, PHP has no way to set a handler for general entities, though 
a 
handler can be set for unparsed entities.

Expat has deprecated the XML_SetUnparsedEntityDeclHandler in favor of 
XML_SetEntityDeclHandler, which is called for all entity types (including 
general 
and unparsed).

http://expat.cvs.sourceforge.net/viewvc/expat/expat/lib/expat.h?
revision=1.80&view=markup#l_311

PHP should add the xml_set_entity_decl_handler function to allow handling of 
all 
entity declarations.


Test script:
---
$data = ']>&generalEntity;';

function 
h_entity_decl($parser,$entity_name,$is_parameter_entity,$value,$base,$system_id,$public_id,$notation_name)
 {
echo "$entity_name - $is_parameter_entity - $value";
};

$parser = xml_parser_create();
xml_set_entity_decl_handler($parser, 'h_entity_decl');

xml_parse($parser,$data,false) or 
die (sprintf("XML Error: %s at line %d\n", 
 xml_error_string(xml_get_error_code($parser)),
 xml_get_current_line_number($parser)));
xml_parser_free($parser);


Expected result:

It should run with the following output:

generalEntity - 0 - General Entity


Actual result:
--
Fatal Error: Call to undefined function xml_set_entity_decl_handler()







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=51939&edit=1


Bug #53041 [Com]: is_file() and open_basedir

2011-07-21 Thread kev at dewsolutions dot co dot uk
Edit report at https://bugs.php.net/bug.php?id=53041&edit=1

 ID: 53041
 Comment by: kev at dewsolutions dot co dot uk
 Reported by:sunseb at live dot com
 Summary:is_file() and open_basedir
 Status: Verified
 Type:   Bug
 Package:*Directory/Filesystem functions
 Operating System:   Linux
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

Still occurs in PHP 5.3.6.

to replicate:
';

// append text to current directory name which should be the dir of 
open_basedir to trigger open_basedir warning
echo 'checking ' . dirname(__FILE__) . 'test ';
var_dump(file_exists(dirname(__FILE__) . 'test'));

// no warning should occur here whether index.php exists or not
echo 'checking ' . dirname(__FILE__) . '/index.php ';
var_dump(file_exists(dirname(__FILE__) . '/index.php'));

// if index.php exists a open_basedir warning will be thrown
echo 'checking ' . dirname(__FILE__) . '/index.php/test ';
var_dump(file_exists(dirname(__FILE__) . '/index.php/test'));


Previous Comments:

[2011-02-26 22:32:43] info at riastudio dot fr

Still occurs in 5.3.5, more than annoying when you have a lot of vhosts with 
open_basedir + error_reporting E_ALL


[2011-02-02 17:26:18] mjk at emmjaykay dot org

My apologies. But it says "directory: /home/my_file.txt" so I the directions 
were a little unclear. sry


[2011-02-02 12:39:14] sjon at react dot com

apart from you not reproducing the bug correctly (my_file.txt should obviously 
be a file, not a directory), this seems to have been fixed by now.

I suspect this to fix it:

http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c?r1=264931&r2=264932&;


[2011-02-01 19:06:53] mjk at emmjaykay dot org

I setup my machine as described in this bug and changed my /etc/php.ini so that 
open_basedir = /home/, mkdir /home/my_file.txt and did a touch 
/home/my_file.txt/whatever. I then ran this script



and got this

bool(false)
bool(true)

Is there another change I need to make to php.ini or something I'm missing?


[2011-01-07 14:08:04] sjon at react dot com

this problem still occurs in 5.3.5




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

https://bugs.php.net/bug.php?id=53041


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=53041&edit=1


Bug #55239 [Com]: dbase date field

2011-07-21 Thread m4rk dot gm4il at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55239&edit=1

 ID: 55239
 Comment by: m4rk dot gm4il at gmail dot com
 Reported by:m4rk dot gm4il at gmail dot com
 Summary:dbase date field
 Status: Bogus
 Type:   Bug
 Package:dBase related
 Operating System:   WINXP
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

Hi,

Thanks for your response.

When I execute the same var_dump command,
I can also see the same result as yours on the browser.

But when I actually open the database on excel or foxpro, I
can see the structure. the "Date" and "Logical" 
data fields have '0' length.

I also tried to create a sample database using foxpro
with data on it and the structure has correct field length 
with "Date" and "Logical" types.  

Then using that database created from foxpro and using the 
same given code but I just removed the database creation part,  
I opened the database using dbase_open() and inserted the record
using dbase_add_record(), it also resulted from 0 FIELD LENGTH
for Date and Logical types.


Previous Comments:

[2011-07-19 18:21:15] fel...@php.net

Hi, report dbase bugs on http://pecl.php.net/bugs/report.php?package=dbase

Anyway, I've tested and it works fine:


  string(8) "20110719"
  [1]=>
  string(50) "Maxim Topolov "
  [2]=>
  int(23)
  [3]=>
  string(128) "m...@example.com 
"
  [4]=>
  int(1)
  ["deleted"]=>
  int(0)
}


[2011-07-19 07:12:25] m4rk dot gm4il at gmail dot com

Description:

---
>From manual page: http://www.php.net/function.dbase-add-record%23Examples
and http://www.php.net/manual/en/function.dbase-create.php
---



Expected result:

the data on date, name, age, email, ismember
should all be saved on dbf.


Actual result:
--
upon saving the database, the date field and ismember field have 0 length.







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55239&edit=1