Req #65652 [Com]: isset alternative

2013-09-11 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=65652&edit=1

 ID: 65652
 Comment by: anon at anon dot anon
 Reported by:kozak at eurosat dot cz
 Summary:isset alternative
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   ALL
 PHP Version:5.5.3
 Block user comment: N
 Private report: N

 New Comment:

echo array_key_exists('b', get_defined_vars()) ? "exists" : "doesn't exist";


Previous Comments:

[2013-09-11 12:34:01] kozak at eurosat dot cz

Description:

At the moment isset call return true only when variable is set and it is not 
null.

But there is no way (or I do not find it so far), how to just test variable for 
existance. So it will be perfect if there will be some other call (for eg: 
exist) 
or some parametr how to get this behaviour
More in example. 

Test script:
---
$a = null;
$testOnlyExistence = true;

echo isset($b); // prints false;
echo isset($a); // prints false;
echo isset($a, $testOnlyExistence); // prints true;
echo isset($b, $testOnlyExistence); // prints false;
// or
echo exist($a); // prints true;
echo exist($b); // prints false;







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


Req #65608 [Com]: Possible problems with the UNIX timestamp

2013-09-04 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=65608&edit=1

 ID: 65608
 Comment by: anon at anon dot anon
 Reported by:jiri dot kapinus at gmail dot com
 Summary:Possible problems with the UNIX timestamp
 Status: Not a bug
 Type:   Feature/Change Request
 Package:Date/time related
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

The "bug" emerges from the assumption that if you take a time in time zone A, 
offset it by some amount, and then convert it to time zone B; you would get the 
same result as converting it to time zone B first, and then offsetting it.

Unfortunately, that assumption isn't true. Monticello used to be on Central 
Time. Now it's on Eastern Time.

It's definitely annoying, but it's not a bug in PHP. Time is HARD. For more 
pitfalls, see:
* 
http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time
* 
http://infiniteundo.com/post/25509354022/more-falsehoods-programmers-believe-about-time-wisdom


Previous Comments:

[2013-09-04 02:47:48] ras...@php.net

I don't understand what you think the bug is here. Of course you can't just add 
the timestamp to the starting date for Unix time and expect it to work for all 
timezones. It completely ignores daylight savings along the way. If you can 
explain yourself better using a single timezone and prove that what you are 
seeing isn't simply the effect of daylight savings you can re-open this.


[2013-09-03 08:45:59] jiri dot kapinus at gmail dot com

instead of ,,when convert this time to America/Kentucky/Monticello, it returns 
following date for Monticello timezone" 

is right this: 

,,when we set the time with parametr UNIX timestamp 0, it returns UNIX 
timestamp 
start time for Monticello timezone"


[2013-09-03 08:28:49] jiri dot kapinus at gmail dot com

Description:

The UNIX timestamp gives the number of seconds since January 1 1970 00:00:00 
UTC. 
But value of UNIX timestamp can be different, that in really is. More 
information 
on http://www.najdouvas.cz/unix-timestamp-error/

Test script:
---
";
date_default_timezone_set('America/Kentucky/Monticello');
echo "Current time and date in America/Kentucky/Monticello timezone: " . 
date("M d Y H:i:s", time()) . "";
echo "UNIX timestamp defined by Strtotime for now: " . strtotime("now")  . " 
";
$start = strtotime("now");
$zonestart = date("M d Y H:i:s", 00);
echo "UNIX timestamp start at: Jan 01 1970 00:00:00 UTC";
echo "when convert this time to America/Kentucky/Monticello, it returns 
following date for Monticello timezone";
echo "UNIX timestamp start at:   " . $zonestart . " America/Kentucky/Monticello 
timezone";
echo "To this date we add UNIX timestamp for NOW time. The result may be the 
same as the current time and date for America/Kentucky/Monticello ";
$date = date_create($zonestart);
$date->modify('+ ' . $start . ' sec');
echo "Result is: " . $date->format('M d Y H:i:s e') . "";
date_default_timezone_set('UTC');
$date->setTimezone(new DateTimeZone("UTC")); 
echo "Changing this time to UTC timezone: " . $date->format('M d Y H:i:s e') . 
"";
echo "When final date is not the same as the date at the begining, it means, 
that the UNIX timestamp don't give up exact number of second for this place or 
timezone. The UNIX timestamp gives the number of seconds since January 1 1970 
00:00:00 UTC. But it's different for different places.";
?>







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


Bug #65596 [Com]: usleep prevents script timeout

2013-08-30 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=65596&edit=1

 ID: 65596
 Comment by: anon at anon dot anon
 Reported by:ukrtelecom at gmail dot com
 Summary:usleep prevents script timeout
 Status: Wont fix
 Type:   Bug
 Package:*General Issues
 Operating System:   Linux
 PHP Version:5.4Git-2013-08-30 (snap)
 Block user comment: N
 Private report: N

 New Comment:

@ab Well of course it's solvable.
1. sleepTime = min(specifiedTime, timeLimit - scriptTime)
2. Do system call.
3. scriptTime += sleepTime

I don't understand why you track script time in such a bizarre fashion that it 
somehow doesn't contribute to the time limit anyway.


Previous Comments:

[2013-08-30 18:00:25] a...@php.net

This is unsolvable in PHP, sleep is a system call so it will suspend the 
execution 
. It can be only interrupted by a signal which can't be thrown from PHP because 
the execution is suspended :)


[2013-08-30 15:47:44] ukrtelecom at gmail dot com

Description:

Usleeped time does not count in total timeout time.

Commenting out line 11 "usleep(10)" in the test script results with expected 
Fatal timeout in 2 seconds.
Enabling line 11 "usleep(10)" makes script exit by condition in 50 seconds.
Increasing waiting time to 100 seconds in line 2 results with timeout Fatal 
error in 60-70 sec.


PHP 5.4.20-dev (cli) (built: Aug 30 2013 14:18:16) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

./configure --disable-libxml --disable-xml --disable-simplexml --disable-
xmlreader --disable-xmlwriter --disable-dom --without-pear

OS Ubuntu 12.04 LTS 
Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 
x86_64 x86_64 x86_64 GNU/Linux

Test script:
---
 $wait) {
echo time() -$ts;
echo "\n\nFailed! " . ini_get('max_execution_time') . "\n";
break;
}
}



Expected result:

0
Fatal error: Maximum execution time of 2 seconds exceeded in 
/home/vagrant/t.php 
on line 12

Actual result:
--
#with wait time 50 sec:
$ date; php t.php ; date
Fri Aug 30 15:40:54 UTC 2013
0
51

Failed! 2
Fri Aug 30 15:41:45 UTC 2013


#with wait time 100 sec:
$ date; php t.php ; date
Fri Aug 30 15:35:45 UTC 2013
0

Fatal error: Maximum execution time of 2 seconds exceeded in 
/home/vagrant/t.php 
on line 12
Fri Aug 30 15:36:40 UTC 2013







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


Bug #65376 [Com]: Unserialize function issue

2013-08-03 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=65376&edit=1

 ID: 65376
 Comment by: anon at anon dot anon
 Reported by:carlosV2 dot 0 at gmail dot com
 Summary:Unserialize function issue
 Status: Not a bug
 Type:   Bug
 Package:*General Issues
 Operating System:   Mac OS X
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

@mike Did you just dismiss a feature request as "Not a bug"? Of course it's not 
a bug, it's a feature request.


Previous Comments:

[2013-08-02 11:20:20] m...@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.

.


[2013-08-02 08:27:35] carlosV2 dot 0 at gmail dot com

Description:

I think the unserialize method should have a final string length check.

You can make objects disappear just running the code in the Test Script:

This code outputs just the first object.
This is something it can easily happend when you are working with sockets or 
data 
streams.

Probably it is the developer's fault but actually to serialized objects 
together 
are not only one object.

I think checking the string length at the end of the parser and rising a 
warning 
is enough to alert the developer that this things are happening.

Test script:
---
$o1 = new stdClass();
$o1->name = 'Object1';

$o2 = new stdClass();
$o2->name = 'Object2';

$objects = serialize($o1) . serialize($o2);
print_r(unserialize($objects));

Expected result:

A warning

Actual result:
--
Only the first object:

stdClass Object
(
[name] => Object1
)






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


Req #65321 [Com]: Extend sprintf function by type specifier for uppercase and lowercase

2013-07-24 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=65321&edit=1

 ID: 65321
 Comment by: anon at anon dot anon
 Reported by:nico dot weinreich at gmail dot com
 Summary:Extend sprintf function by type specifier for
 uppercase and lowercase
 Status: Open
 Type:   Feature/Change Request
 Package:Unknown/Other Function
 Operating System:   All
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

Easily done in user land.

function foo($s) {
$args = func_get_args();
return preg_replace_callback('/%(.)/', function($matches) use(&$args) {
switch ($matches[1]) {
case '%': return '%';
case 's': return next($args);
case 't': return mb_convert_case(next($args), MB_CASE_LOWER);
case 'T': return mb_convert_case(next($args), MB_CASE_UPPER);
}
}, $s);
}

echo foo('Alla %t på %s', 'Uppslagsord', 'K');

-> Alla uppslagsord på K


Previous Comments:

[2013-07-24 08:10:45] nico dot weinreich at gmail dot com

Description:

I'm using sprintf() to realize multi language setup of my projects in a simple 
way, e.g.:

$l['Stichworte'] = 'Uppslagsord';
$l['Alle %s mit %s'] = 'Alla %s på %s';

Base language is german, target language is swedish. On runtime I'm doing 
something like:

echo sprintf(Lang::get("Alle %s mit %s"), Lang::get("Stichworte"), 'K');

So I get for german 'Alle Stichworte mit K' and for swedish 'Alla Uppslagsord 
på 
K'. The problem is, in this context the word 'Uppslagsord' has to be in 
lowercase for swedish.

So it would be great, if there are two more type specifiers for sprintf() to 
allow text transformation, e.g.:

%s - the argument is treated as and presented as a string
%t - the argument is treated as and presented as a lowercase string
%T - the argument is treated as and presented as a uppercase string








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


Req #65202 [Com]: array_rand not function

2013-07-04 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=65202&edit=1

 ID: 65202
 Comment by: anon at anon dot anon
 Reported by:terracota09 at gmail dot com
 Summary:array_rand not function
 Status: Open
 Type:   Feature/Change Request
 Package:Arrays related
 Operating System:   Windows 7
 PHP Version:5.3Git-2013-07-04 (Git)
 Block user comment: N
 Private report: N

 New Comment:

But [0] does exist in array $a. It's the very first entry:
Array
(
[0] => 9
[1] => 26
[2] => 31
...
}
That's why array_rand is generating it.

If you mean to generate values of $a rather than keys do:

for ($i = 0; $i < 6; $i++) {
if ($i) echo " - ";
echo $a[$rand_keys[$i]];
}


Previous Comments:

[2013-07-04 10:03:17] terracota09 at gmail dot com

Description:

http://localhost:8080/arrayAleatorio.php?juego=8

";
$rand_keys = array_rand($a, 6);
asort($rand_keys);

print_r($rand_keys);

//$i = 0;
for ($i = 0; $i < 6; $i++) {
//foreach ($rand_keys as $val) {
//$i++;
if ($i < 5)
echo $rand_keys[$i]." - "; //echo $val." - ";
else
echo $rand_keys[$i]; //echo $val;
}
echo "";
if (($j%2) == 0) 
echo "";

}

Test script:
---
Array ( [0] => 4 [1] => 8 [2] => 13 [3] => 16 [4] => 17 [5] => 46 ) 4 - 8 - 13 
- 16 - 17 - 46

Array ( [0] => 7 [1] => 9 [2] => 11 [3] => 16 [4] => 28 [5] => 32 ) 7 - 9 - 11 
- 16 - 28 - 32


Array ( [0] => 18 [1] => 23 [2] => 29 [3] => 34 [4] => 35 [5] => 43 ) 18 - 23 - 
29 - 34 - 35 - 43

Array ( [0] => 1 [1] => 6 [2] => 7 [3] => 13 [4] => 27 [5] => 44 ) 1 - 6 - 7 - 
13 - 27 - 44


Array ( [0] => 7 [1] => 14 [2] => 32 [3] => 41 [4] => 42 [5] => 48 ) 7 - 14 - 
32 - 41 - 42 - 48

Array ( [0] => 7 [1] => 13 [2] => 15 [3] => 22 [4] => 27 [5] => 38 ) 7 - 13 - 
15 - 22 - 27 - 38


Array ( [0] => 0 [1] => 2 [2] => 3 [3] => 29 [4] => 43 [5] => 49 ) 0 - 2 - 3 - 
29 - 43 - 49

Array ( [0] => 18 [1] => 23 [2] => 33 [3] => 34 [4] => 36 [5] => 39 ) 18 - 23 - 
33 - 34 - 36 - 39

Expected result:

0 not exist in array

Actual result:
--
Array ( [0] => 4 [1] => 8 [2] => 13 [3] => 16 [4] => 17 [5] => 46 ) 4 - 8 - 13 
- 
16 - 17 - 46

Array ( [0] => 7 [1] => 9 [2] => 11 [3] => 16 [4] => 28 [5] => 32 ) 7 - 9 - 11 
- 
16 - 28 - 32


Array ( [0] => 18 [1] => 23 [2] => 29 [3] => 34 [4] => 35 [5] => 43 ) 18 - 23 - 
29 - 34 - 35 - 43

Array ( [0] => 1 [1] => 6 [2] => 7 [3] => 13 [4] => 27 [5] => 44 ) 1 - 6 - 7 - 
13 - 27 - 44


Array ( [0] => 7 [1] => 14 [2] => 32 [3] => 41 [4] => 42 [5] => 48 ) 7 - 14 - 
32 
- 41 - 42 - 48

Array ( [0] => 7 [1] => 13 [2] => 15 [3] => 22 [4] => 27 [5] => 38 ) 7 - 13 - 
15 
- 22 - 27 - 38


Array ( [0] => 40 [1] => 2 [2] => 3 [3] => 29 [4] => 43 [5] => 49 ) 40 - 2 - 3 
- 
29 - 43 - 49

Array ( [0] => 18 [1] => 23 [2] => 33 [3] => 34 [4] => 36 [5] => 39 ) 18 - 23 - 
33 - 34 - 36 - 39






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


Bug #65190 [Com]: Bug: ampersand "&" not removed completely "amp;" in query string!

2013-07-03 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=65190&edit=1

 ID: 65190
 Comment by: anon at anon dot anon
 Reported by:remoteshaman dot com at gmail dot com
 Summary:Bug: ampersand "&" not removed completely "amp;"
 in query string!
 Status: Not a bug
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   CentOS
 PHP Version:5.3.26
 Block user comment: N
 Private report: N

 New Comment:

Yes it's not a bug, it's a feature. `&` is an HTML thing. It has nothing to 
do with query strings except when you're encoding them in HTML, which you're 
not; you're just putting the `&` literally into the URL. It doesn't belong 
there. Remove it.


Previous Comments:

[2013-07-03 10:26:40] remoteshaman dot com at gmail dot com

And "arg_sepErator" this a not directive!:) and "arg_sepArator" so - have 
"arg_separator.output" and "arg_separator.input" but this not solved issue!


[2013-07-03 10:18:48] remoteshaman dot com at gmail dot com

this string 
"?f=c3c0e998b57b4a2b8046f12a89dfff49-cache-plg_jch_optimize-e9898cc42c78127028aba1dab284f305&type=js&d=30"
 get and print_r($_REQUEST) after set (php_flag arg_separator.input "&") in 
.htaccess
--
Array
(
[f] => 2
[41e3cc488db] => 
[92b567b7fa14ea5c66-cache-plg_jch_optimize-] => 
[ab5] => 
[adafe538259f] => 
[d7936372397432&type] => css&d=3
)
--

this string 
"?f=c3c0e998b57b4a2b8046f12a89dfff49-cache-plg_jch_optimize-e9898cc42c78127028aba1dab284f305&type=js&d=30"
 get and print_r($_REQUEST) after set (php_value arg_separator.input "&") 
in .htaccess
--
Array
(
[f] => 2041e3cc488db092b567b7f
[14e] => 
[5c66-c] => 
[che-] => 
[lg_jch_o] => 
[ti] => 
[ize-0] => 
[b50] => 
[d] => 30
[fe538259f0d7936372397432] => 
[ty] => 
[e] => css
)
--


[2013-07-03 07:51:21] ras...@php.net

The default arg_seperator is just &
You can set it to & in your ini if you like.


[2013-07-03 07:24:46] remoteshaman dot com at gmail dot com

Description:

Bug: ampersand "&" not removed completely "amp;" in query string!


Test script:
---
 
2041e3cc488db092b567b7fa14ea5c66-cache-plg_jch_optimize-35c9937b8d9d493d64405d18f2d6f5aa
// [amp;type] => js
// [amp;d] => 30
// )

// Bug: ampersand "&" not removed completely "amp;"!

// or this a feature?:))








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


Req #64826 [Com]: Important error

2013-05-14 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=64826&edit=1

 ID: 64826
 Comment by: anon at anon dot anon
 Reported by:coolcool1994 at gmail dot com
 Summary:Important error
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   Mac
 PHP Version:5.5Git-2013-05-12 (Git)
 Block user comment: N
 Private report: N

 New Comment:

Is there a particular language edition of the manual you're referring to? 
Because it looks fine to me.


Previous Comments:

[2013-05-12 21:20:46] coolcool1994 at gmail dot com

Description:

---
>From manual page: http://www.php.net/function.strstr#refsect1-function.strstr-
examples
---

strrchr should be used for the first example instead. Because strrstrr only 
catches the first occurance of the letter from the beginning of the string. 
strrchr should be used to find the first occurance of the letter from the end 
of 
the string.

Test script:
---
I tested but I do not have it here.

Expected result:

It is a common sense. Fix it!

Actual result:
--
It is a common sense. Fix it!






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


Bug #64637 [Com]: redefine NULL

2013-04-12 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=64637&edit=1

 ID: 64637
 Comment by: anon at anon dot anon
 Reported by:rstoll at tutteli dot ch
 Summary:redefine NULL
 Status: Open
 Type:   Bug
 Package:*Languages/Translation
 Operating System:   windows
 PHP Version:5.4.7
 Block user comment: N
 Private report: N

 New Comment:

Tested on PHP 5.3.5 on Windows and I just get NULL as output all four times, 
and then the notice. Seems normal.


Previous Comments:

[2013-04-12 11:21:28] rstoll at tutteli dot ch

Maybe the bug only exists on windows.
I got the error for 5.4.7 and 5.3.5


[2013-04-12 04:14:04] larue...@php.net

http://3v4l.org/8knru

I didn't see a "hello world" outputted


[2013-04-11 23:23:28] rstoll at tutteli dot ch

Description:

It is possible to redefine NULL (however, not null). No one probably does that 
but it should not be possible. Maybe there are more of this kind of errors. 

Test script:
---
var_dump(null); // null
var_dump(NULL); // null
define("NULL","hello world");
var_dump(null); // null
var_dump(NULL); // hello world
define("null","hello world"); //Notice: Constant null already defined








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


Bug #64390 [Com]: round() corrupted

2013-03-10 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=64390&edit=1

 ID: 64390
 Comment by: anon at anon dot anon
 Reported by:bugzilla77 at gmail dot com
 Summary:round() corrupted
 Status: Not a bug
 Type:   Bug
 Package:Math related
 Operating System:   Win 7
 PHP Version:5.5.0alpha5
 Block user comment: N
 Private report: N

 New Comment:

>Negative zero in mathematics does not exist.
Then you should also report this against most programming environments that 
have ever existed, because negative zero is that common, and is even part of an 
international standard for floating-point representation.

https://en.wikipedia.org/wiki/Negative_zero


Previous Comments:

[2013-03-08 12:09:56] johan...@php.net

Floating point values have a limited precision. Hence a value might 
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly 
printing it without any mathematical operations.

If you would like to know more about "floats" and what IEEE
754 is, read this:
http://www.floating-point-gui.de/

Thank you for your interest in PHP.

.


[2013-03-08 11:45:17] bugzilla77 at gmail dot com

Description:

Negative zero in mathematics does not exist.


Test script:
---



Expected result:

0


Actual result:
--
-0







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


Bug #64299 [Com]: Global variables not visible when using CLI

2013-02-28 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=64299&edit=1

 ID: 64299
 Comment by: anon at anon dot anon
 Reported by:andrew dot mof at gmail dot com
 Summary:Global variables not visible when using CLI
 Status: Not a bug
 Type:   Bug
 Package:Variables related
 Operating System:   Ubuntu 12.10
 PHP Version:5.4.12
 Block user comment: N
 Private report: N

 New Comment:

@pajoye: register_globals has nothing to do with this; what are you saying?

That said, the test script appears to work perfectly. How could it not?


Previous Comments:

[2013-02-26 04:16:17] paj...@php.net

In PHP 4.2.0, the 'register_globals' setting default changed to
'off'. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.

There is no bug here. Works just fine.


[2013-02-25 21:50:34] andrew dot mof at gmail dot com

Description:

99% sure this is a bug. This code works fine when apache runs it but when I run 
it though CLI it doesnt see the variable.

That said, this work:

$GLOBALS['jobID'] = 123;

Test script:
---
#!/usr/bin/php
https://bugs.php.net/bug.php?id=64299&edit=1


Req #64266 [Com]: Pass arrays as reference by default

2013-02-23 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=64266&edit=1

 ID: 64266
 Comment by: anon at anon dot anon
 Reported by:stormbyte at gmail dot com
 Summary:Pass arrays as reference by default
 Status: Wont fix
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   Linux
 PHP Version:5.4.11
 Block user comment: N
 Private report: N

 New Comment:

@stormbyte
>objects are already passed by reference as default

Nope. Objects in PHP 5+ are not like those in C (which are value-types); PHP 
objects have implicit reference semantics (same as Java). But parameters are 
ALWAYS passed by value unless the '&' is there explicitly.

Example:

class Foo {
public $i;
public function __construct($i) {
$this->i = $i;
}
public function __toString() { return $this->i . ''; }
}

$obj1 = new Foo(1);
$obj2 = new Foo(2);

$obj = $obj1;
echo $obj;

doSomethingWith($obj);
function doSomethingWith($obj) {
$obj->i = 3;
$obj = $GLOBALS['obj2'];
echo $obj;
}

echo $obj;
echo $obj1;

-

Output is 1233. If PHP passed objects by reference by default, it would be 
1223, which is the same value you'll get if you manually add the '&' to the 
parameter declaration. However, notice obj1 gets modified either way (the last 
digit) because even the plain assignment ($obj = $obj1) assigns the object 
address and not the contents.


Previous Comments:

[2013-02-21 14:55:14] ras...@php.net

Because PHP uses Copy-On-Write there is actually no performance benefit to 
passing anything by reference in PHP. In fact creating a reference is slower. 
Also, while you are correct that C/C++ passes arrays by reference by default, 
this is mainly because there is simply no way to pass a block of memory by 
value. If you want to make actual changes to the passed array you would still 
have to pass an int** since if you need to change the size of the array and re-
alloc the block of memory you need a pointer to the pointer, so in essence 
passing an int* in C is its form of pass-by-value as it simply avoids doing a 
copy, but doesn't give the receiving function the ability to make real changes 
to the array and passing an int** is C's version of pass-by-reference. This 
exactly mirrors PHP's behaviour. Passing a PHP array by value doesn't make a 
copy of the array because of COW and is thus analogous to passing an int* in C 
and PHP's pass-by-reference is exactly like C's passing of an int**.


[2013-02-21 14:51:22] johan...@php.net

C has no references, but pointers which are a quite different concept. Pass by 
pointer is neccessary in C to allow maximum performance. In PHP we have copy on 
write and prefer more intuitive APIs. When reading foo($variable) it is unclear 
whether $variable will be read only or manipulated, which makes reading code 
harder. By defaulting to "copies" this is lost.

Also mind that objects are not passed by reference but by handle.

To learn more please see
http://php.net/manual/en/language.references.php
http://php.net/manual/en/features.gc.refcounting-basics.php
http://php.net/manual/en/language.oop5.references.php
http://schlueters.de/blog/archives/125-Do-not-use-PHP-references.html


[2013-02-21 14:22:39] stormbyte at gmail dot com

Description:

One of major benefits from PHP is that it is very close to C/C++ style, so it 
is its functions and coding style (very similar for, while and those 
constructs) so if you come from C/C++ world, you have it easy.

To keep this consistence I suggest, as well as C/C++ does, passing arrays as 
reference in function arguments by default, or at least an option to behave 
like that.

For me, it does not make much sense to "follow" C/C++ coding styles and 
behaviour, while not following that behaviour.

Furthermore, objects are already passed by reference as default, so why not 
arrays? IMHO I think that inconsistence may confuse programmers.

Test script:
---
function foo($arr) {
  array_push($arr, "test");
}

function bar(&$arr) {
  array_push($arr, "test");
}

$a=array();
foo($a);
//$a is empty
bar($a);
//$a[0]="test"

Expected result:

To be consistent with the rest behaviour of "imitating" C/C++ and pass arrays 
as reference automatically as well as objects are.
Also, it may be a performance gain by doing that (which is one of the reasons 
in C world it is that way)







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


Bug #64162 [Com]: Extra characters added to base64_decode() output

2013-02-18 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=64162&edit=1

 ID: 64162
 Comment by: anon at anon dot anon
 Reported by:rob at neovidamedia dot com
 Summary:Extra characters added to base64_decode() output
 Status: Not a bug
 Type:   Bug
 Package:*Encryption and hash functions
 Operating System:   Windows 7
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

>I have consulted a couple of other programmers, both of whom are much better 
>than I

Christ. Anyone is better than you.

Charles Babbage in 1864 gave us this quote regarding his design for the first 
mechanical calculator: "On two occasions I have been asked,—'Pray, Mr. 
Babbage, if you put into the machine wrong figures, will the right answers come 
out?'...I am not able rightly to apprehend the kind of confusion of ideas that 
could provoke such a question."

I'm wondering the same thing as Babbage. You're giving base64_decode additional 
nonsense bytes, which by your very admission are chosen at random, then you 
have the audacity to blame it for not contorting those random bytes into the 
right answers.

>As far as I can tell this is still a bug.

Are you suggesting base64_decode be programmed with magic?

CHOP THE BYTES OFF YOU MORON (as @bobwei9 explained).


Previous Comments:

[2013-02-06 21:40:37] rob at neovidamedia dot com

Actually, the code I have written works in most instances.  There are a handful 
that don't work, such as the sample that I have provided ($a = 
"Proteussing88";).  As per substr(): strlen will give you the length of a 
string 
where the first character is character 1 -- in substr() positions start with 
the 
first character being in position 0 (like an array).  Hence, I don't think that 
I have to remove 2 characters, or 4.  I could be wrong as I am not an expert 
professional, but I have consulted a couple of other programmers, both of whom 
are much better than I, and they can't solve this either.

Believe me, this code works 95%+ of the time.  Please refer to this part of the 
description:

"It seems to be related to the string length of $a, and the fact that it 
contains a number at its end, but I could be wrong."

Also, I upgraded PHP to 5.3 and this piece of code still failed.

As far as I can tell this is still a bug.


[2013-02-06 16:02:34] ras...@php.net

You can't arbitrarily add random characters to the base64-encoded string and 
expect to get sensible output. You are adding 1 char before and 3 after to your 
encoded string, but then you do base64_decode(substr($pass, 1, (strlen($pass) - 
2))) meaning you only remove 2 of those appended chars before you decode. Make 
that strlen()-3 and your problems go away. The fact that it differs across 
versions is irrelevant since you are not passing in a valid base64 encoded 
string.


[2013-02-06 16:00:19] bobwei9 at hotmail dot com

But whatever; there is also an error in your script:

$final = base64_decode(substr($pass, 1, (strlen($pass) - 4)));

would be right.


However, somewhere between 5.3.15 and trunk, base64_decode()-handling of 
invalid characters (after the last =) has changed...


[2013-02-06 15:52:17] bobwei9 at hotmail dot com

Effectively. On PHP 5.3 there is a byte with \x02 and on trunk \x07...

Alone this difference must be a bug...


[2013-02-06 11:10:30] rob at neovidamedia dot com

Description:

---
>From manual page: http://www.php.net/function.base64-decode
---

Run this code, and notice the output for 'Decoded' -- it looks the same as 
'Original', but it is not.  Select it (the result), copy it, and paste it into 
notepad or something, and you will see a bonus character at the end.

It seems to be related to the string length of $a, and the fact that it 
contains 
a 
number at its end, but I could be wrong.  I ran about one hundred different 
scenario tests, and got some funky results.

PS - I am running PHP 5.2.17, but that is what my host offers.  Don't think I 
can upgrade on my own ...

Test script:
---
$a = "Proteussing88";

function randLetter()
{
$int = rand(0,61);
$a_z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
$rand_letter = $a_z[$int];
return $rand_letter;
}
$pass = randLetter() . base64_encode($a) . randLetter() . randLetter() . 
randLetter();

$db_pass = base64_decode(substr($pass, 1, (strlen($pass) - 2)));
$final = substr($db_pass, 0, (strlen($

Bug #63769 [Com]: file:// protocol does not support percent-encoded characters

2013-01-05 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=63769&edit=1

 ID: 63769
 Comment by: anon at anon dot anon
 Reported by:hanskrentel at yahoo dot de
 Summary:file:// protocol does not support percent-encoded
 characters
 Status: Not a bug
 Type:   Bug
 Package:Streams related
 Operating System:   Windows
 PHP Version:5.4.9
 Block user comment: N
 Private report: N

 New Comment:

Actually, hold on a sec, plus signs are *not* supposed to be decoded here. That 
means that file names containing plus signs would not be broken by a fix, and 
only file names containing a '%xx' (where x is a hexit) sequence would be 
affected, which is probably uncommon. Perhaps you have a chance.


Previous Comments:

[2013-01-06 06:38:45] anon at anon dot anon

>You would have wanted to access it via 'file:///C:/temp/catalog%%25202.xml'

Actually, 'catalog%25202.xml', but I know, I'm agreeing with you. I'm just 
pointing out that this erroneous behavior may be depended on somewhere in some 
PHP script, where the author, in good faith, did whatever made things work. I 
assume you're going to pass your path through urldecode (or not encode it in 
the first place), and then you'll be one of them.

In any case, you're unlikely to get any support here. The reviewers here don't 
do much except dismiss things as 'Not a bug' and once they've successfully done 
that they lose interest. C'est le PHP.


[2013-01-06 01:29:30] hanskrentel at yahoo dot de

If you would create a file named

catalog%202.xml.

You would have wanted to access it via:

'file:///C:/temp/catalog%%25202.xml'

which as well does not work. I'm not doing a bug report here to be treated like 
an idiot. I better suggest you piss completely off 
instead of leaving such an idiotic comment. My 2 cents.

--------
[2012-12-20 16:27:43] anon at anon dot anon

>The path "file:///C:/temp/catalog%202.xml" (without the quotes) does *not* 
>work.

Unfortunately it does work, if you create a file literally named 
catalog%202.xml. PHP's behavior is broken but it's impossible to alter it 
without breaking compatibility.


[2012-12-17 14:55:51] hanskrentel at yahoo dot de

I beg your pardon, but if both are perfectly valid filenames, the fs function 
behaviour is broken (and not correct), because it does not work with both 
perfectly valid filenames:

The path "file:///C:/temp/catalog%202.xml" (without the quotes) does *not* work.

The request is to remove this shortcoming and have it work. I thought this was 
clear from the initial report. Please let me know how I can further assist with 
this.


[2012-12-15 11:12:14] a...@php.net

Since both "catalog%202.xml" and "catalog 2.xml" are perfectly valid filenames, 
the fs function behaviour is correct. The user can decide where it's needed url 
encoded and where it's not.




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=63769


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


Bug #63769 [Com]: file:// protocol does not support percent-encoded characters

2013-01-05 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=63769&edit=1

 ID: 63769
 Comment by: anon at anon dot anon
 Reported by:hanskrentel at yahoo dot de
 Summary:file:// protocol does not support percent-encoded
 characters
 Status: Not a bug
 Type:   Bug
 Package:Streams related
 Operating System:   Windows
 PHP Version:5.4.9
 Block user comment: N
 Private report: N

 New Comment:

>You would have wanted to access it via 'file:///C:/temp/catalog%%25202.xml'

Actually, 'catalog%25202.xml', but I know, I'm agreeing with you. I'm just 
pointing out that this erroneous behavior may be depended on somewhere in some 
PHP script, where the author, in good faith, did whatever made things work. I 
assume you're going to pass your path through urldecode (or not encode it in 
the first place), and then you'll be one of them.

In any case, you're unlikely to get any support here. The reviewers here don't 
do much except dismiss things as 'Not a bug' and once they've successfully done 
that they lose interest. C'est le PHP.


Previous Comments:

[2013-01-06 01:29:30] hanskrentel at yahoo dot de

If you would create a file named

catalog%202.xml.

You would have wanted to access it via:

'file:///C:/temp/catalog%%25202.xml'

which as well does not work. I'm not doing a bug report here to be treated like 
an idiot. I better suggest you piss completely off 
instead of leaving such an idiotic comment. My 2 cents.

------------
[2012-12-20 16:27:43] anon at anon dot anon

>The path "file:///C:/temp/catalog%202.xml" (without the quotes) does *not* 
>work.

Unfortunately it does work, if you create a file literally named 
catalog%202.xml. PHP's behavior is broken but it's impossible to alter it 
without breaking compatibility.


[2012-12-17 14:55:51] hanskrentel at yahoo dot de

I beg your pardon, but if both are perfectly valid filenames, the fs function 
behaviour is broken (and not correct), because it does not work with both 
perfectly valid filenames:

The path "file:///C:/temp/catalog%202.xml" (without the quotes) does *not* work.

The request is to remove this shortcoming and have it work. I thought this was 
clear from the initial report. Please let me know how I can further assist with 
this.


[2012-12-15 11:12:14] a...@php.net

Since both "catalog%202.xml" and "catalog 2.xml" are perfectly valid filenames, 
the fs function behaviour is correct. The user can decide where it's needed url 
encoded and where it's not.


[2012-12-14 15:51:57] hanskrentel at yahoo dot de

Description:

Using a file-URI containing characters that are percent-encoded (one byte/octet 
is encoded as a character triplet, e.g. Space -> %20) do not work. The URI is 
not properly decoded.

Consider the following file on disk:

c:\temp\catalog 2.xml

PHP is able to find it existing via:

is_file('file:///C:/temp/catalog 2.xml');

However, commonly that file is written as:

file:///C:/temp/catalog%202.xml

And using that filename in PHP via:

is_file('file:///C:/temp/catalog%202.xml');

gives FALSE.

(Example is a libxml catalog file, properly specified for libxml)

When you're looking into this, it might be worth to also look for + as encoding 
for space - just not that this case gets overlooked.




Test script:
---
 '/', ' ' => '%20']), 
rawurlencode($name));
printf('%s - %s (%d)', is_file($uri) ? 'OK' : 'FAIL', $uri, unlink($name));

Expected result:

OK - file:///C:/temp/catalog%202.xml (1)

Actual result:
--
FAIL - file:///C:/temp/catalog%202.xml (1)






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


Bug #63769 [Com]: file:// protocol does not support percent-encoded characters

2012-12-20 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=63769&edit=1

 ID: 63769
 Comment by: anon at anon dot anon
 Reported by:hanskrentel at yahoo dot de
 Summary:file:// protocol does not support percent-encoded
 characters
 Status: Not a bug
 Type:   Bug
 Package:Streams related
 Operating System:   Windows
 PHP Version:5.4.9
 Block user comment: N
 Private report: N

 New Comment:

>The path "file:///C:/temp/catalog%202.xml" (without the quotes) does *not* 
>work.

Unfortunately it does work, if you create a file literally named 
catalog%202.xml. PHP's behavior is broken but it's impossible to alter it 
without breaking compatibility.


Previous Comments:

[2012-12-17 14:55:51] hanskrentel at yahoo dot de

I beg your pardon, but if both are perfectly valid filenames, the fs function 
behaviour is broken (and not correct), because it does not work with both 
perfectly valid filenames:

The path "file:///C:/temp/catalog%202.xml" (without the quotes) does *not* work.

The request is to remove this shortcoming and have it work. I thought this was 
clear from the initial report. Please let me know how I can further assist with 
this.


[2012-12-15 11:12:14] a...@php.net

Since both "catalog%202.xml" and "catalog 2.xml" are perfectly valid filenames, 
the fs function behaviour is correct. The user can decide where it's needed url 
encoded and where it's not.


[2012-12-14 15:51:57] hanskrentel at yahoo dot de

Description:

Using a file-URI containing characters that are percent-encoded (one byte/octet 
is encoded as a character triplet, e.g. Space -> %20) do not work. The URI is 
not properly decoded.

Consider the following file on disk:

c:\temp\catalog 2.xml

PHP is able to find it existing via:

is_file('file:///C:/temp/catalog 2.xml');

However, commonly that file is written as:

file:///C:/temp/catalog%202.xml

And using that filename in PHP via:

is_file('file:///C:/temp/catalog%202.xml');

gives FALSE.

(Example is a libxml catalog file, properly specified for libxml)

When you're looking into this, it might be worth to also look for + as encoding 
for space - just not that this case gets overlooked.




Test script:
---
 '/', ' ' => '%20']), 
rawurlencode($name));
printf('%s - %s (%d)', is_file($uri) ? 'OK' : 'FAIL', $uri, unlink($name));

Expected result:

OK - file:///C:/temp/catalog%202.xml (1)

Actual result:
--
FAIL - file:///C:/temp/catalog%202.xml (1)






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


[PHP-BUG] Bug #63597 [NEW]: easter_date is fucking stupid

2012-11-25 Thread anon at anon dot anon
From: anon at anon dot anon
Operating system: 
PHP version:  5.4.9
Package:  Date/time related
Bug Type: Bug
Bug description:easter_date is fucking stupid

Description:

The easter_date function magics a random timezone out of the air, rendering
it worthless.

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



Bug #63473 [Com]: rename rename

2012-11-09 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=63473&edit=1

 ID: 63473
 Comment by: anon at anon dot anon
 Reported by:anon at anon dot anon
 Summary:rename rename
 Status: Open
 Type:   Bug
 Package:Filesystem function related
 PHP Version:5.4.8
 Block user comment: N
 Private report: N

 New Comment:

Apparently PHP doesn't even have a way to merely rename a file. Using 
file_exists with rename will be vulnerable to race conditions (potential file 
overwrites) with other processes.


Previous Comments:

[2012-11-09 18:32:42] anon at anon dot anon

Description:

The rename function overwrites. This is totally unexpected and unintuitive 
behavior which could cause data loss, and it is not even documented.

Combined with the fact that the rename function can "rename" across drives, 
it's obviously a move, not a rename. Then it should be called move, so you can 
tell what it does.

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


[PHP-BUG] Bug #63473 [NEW]: rename rename

2012-11-09 Thread anon at anon dot anon
From: anon at anon dot anon
Operating system: 
PHP version:  5.4.8
Package:  Filesystem function related
Bug Type: Bug
Bug description:rename rename

Description:

The rename function overwrites. This is totally unexpected and unintuitive
behavior which could cause data loss, and it is not even documented.

Combined with the fact that the rename function can "rename" across drives,
it's obviously a move, not a rename. Then it should be called move, so you
can tell what it does.

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



Bug #62943 [Com]: ?& in header causes parameter problem

2012-08-27 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=62943&edit=1

 ID: 62943
 Comment by: anon at anon dot anon
 Reported by:esko dot saajanto at code4m dot com
 Summary:?& in header causes parameter problem
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Debian
 PHP Version:5.3.3-7+squeeze8
 Block user comment: N
 Private report: N

 New Comment:

@esko: We can't access that page because it's a private IP. Can you cause this 
bug with a simple test script like this:



If not, simplify the buggy code until the bug disappears. Then you'll know 
what's triggering it.


Previous Comments:

[2012-08-27 07:53:32] esko dot saajanto at code4m dot com

Tested without suhosin with same results.
http://192.168.1.29/resultcode.fi/sarjat/rcea/rcea_tuomaritoiminta_sarjakausi_palkkiot.php?&piiri_id=100013
 is the header and system is working fine exept I do get variables available 
that are not defined in this module or it's includes. 

This is confirmed by two other programmers who took a carefull look of the 
code. F.ex. I have a variable $sarjakausi_id that is used in perevious pages 
and it comes available to this page even when 'piiri_id' is the only variable 
passed. So somehow this is related to the ampersand mark after the first 
question mark in parameter list. When '&' is left out the 'sarjakausi_id' 
variable is no longer available.


[2012-08-27 07:36:39] ras...@php.net

Looking at the code I don't see how that is in any way possible. You are sure 
this isn't some session-related thing? Can you reproduce it with a simple 
script?
How about if you disable Suhosin, does it still happen?


[2012-08-27 07:32:39] ahar...@php.net

Ah, I see. That does sound very weird.

I can't reproduce your described effects on PHP 5.4.6. I think we'll need a 
self-contained reproduction case that works on a stock 5.3.16 or 5.4.6 to have 
any hope here.


[2012-08-27 07:07:36] esko dot saajanto at code4m dot com

Hi.
I'm not sure if I could make my case understandable. So the problem is not that 
I miss some parameter(s) in header but rather so that I get variables without 
$_GET and $_POST that I shouldn't get according the header sent. This is OK 
because the register globals is on - BUT -

If the first character in the header after '?' is '&' so it brings me all the 
variables used in the previus pages even if I'd have only two parameters in my 
header. That shouldn't be the case?


[2012-08-27 06:41:57] ahar...@php.net

Please note that we don't generally accept bug reports involving Suhosin or 
distribution patched versions of PHP.

My guess is that you're hitting the suhosin.get.max_vars limit because the 
initial & is registering another empty GET variable. Does increasing that fix 
the issue?




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=62943


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


Req #62800 [Com]: Creating/modifying/deleting files in PHP

2012-08-12 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=62800&edit=1

 ID: 62800
 Comment by: anon at anon dot anon
 Reported by:brandonskypimenta at gmail dot com
 Summary:Creating/modifying/deleting files in PHP
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   all
 PHP Version:Newest version of PHP
 Block user comment: N
 Private report: N

 New Comment:

>© 2013
Did you just copyright your inability to read documentation?


Previous Comments:

[2012-08-12 01:32:49] brandonskypimenta at gmail dot com

fixed php version


[2012-08-12 01:31:05] brandonskypimenta at gmail dot com

fixed title


[2012-08-12 01:29:43] brandonskypimenta at gmail dot com

Description:

Any way to create files, delete files, modify files in PHP using these commands?

create_file creates a file.
modify_file edits a file's text.
delete_file immediately deletes a file. WARNING: Deletion will be permanent!
-
© 2013

Test script:
---








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


Req #62538 [Com]: dec_ceil is wrong

2012-07-12 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=62538&edit=1

 ID: 62538
 Comment by: anon at anon dot anon
 Reported by:soneta dot kumar at gmail dot com
 Summary:dec_ceil is wrong
 Status: Not a bug
 Type:   Feature/Change Request
 Package:*Math Functions
 Operating System:   All
 PHP Version:5.3.14
 Block user comment: N
 Private report: N

 New Comment:

@Rasmus: The bug report appears to be about a function in a user comment on the 
ceil manual page: http://php.net/manual/en/function.ceil.php


Previous Comments:

[2012-07-12 08:09:20] ras...@php.net

So what is the bug in PHP? I see the bug in your code, but I don't see a PHP 
bug 
here.

Step-by-step, exploding 1.019 on '.':

$numberpart=explode($separator,$number);

gives you: [0] => 1  [1] => 019

Now we take 019 and insert the separator '.' and position precision (2):

$numberpart[1]=substr_replace($numberpart[1],$separator,$precision,0);

Now we have: [0] => 1   [1] => 01.9

And since $numberpart[0]>0 we do the ceil line:

$numberpart[1]=ceil($numberpart[1]);

ceil(01.9) is obviously going to be 2 which is where you went wrong. Since 
ceil() takes a float it is going to convert the string 01.9 to 1.9.

so we now have:  [0] => 1   [1] => 2

This line seems redundant:

$ceil_number= array($numberpart[0],$numberpart[1]);

You are taking array elements and putting them into an array. Why not just use 
the original array, but regardless, you $ceil_number array will have 1,2 in it.

return implode($separator,$ceil_number);

and this implode will return "1.2" as it should.

Why are you not just using number_format() here?

number_format(1.019,2) gives you what you want and it optionally takes decimal 
and thousands separators too.


[2012-07-12 07:21:42] soneta dot kumar at gmail dot com

Description:

function ceil_dec($number,$precision,$separator)
{
$numberpart=explode($separator,$number); 
$numberpart[1]=substr_replace($numberpart[1],$separator,$precision,0);
if($numberpart[0]>=0)
{$numberpart[1]=ceil($numberpart[1]);}
else
{$numberpart[1]=floor($numberpart[1]);}

$ceil_number= array($numberpart[0],$numberpart[1]);
return implode($separator,$ceil_number);
}

echo ceil_dec(1.019,2,"."); 
// Actual output = 1.2
// Expected output =  1.02


Test script:
---
This is solution :
function ceil_dec($number,$precision,$separator='.')
{
$appendZero = false;
$numberpart=explode($separator,$number); 
$numberpart[1]=substr_replace($numberpart[1],$separator,$precision,0); 
if($numberpart[1][0] == 0)  { $appendZero = true;}
if($numberpart[0]>=0)
{$numberpart[1]=ceil($numberpart[1]);}
else
{$numberpart[1]=floor($numberpart[1]);}
if($appendZero){ $numberpart[1] = (int) '0'.$numberpart[1];}
$ceil_number= array($numberpart[0],$numberpart[1]);
return implode($separator,$ceil_number);
}

Expected result:

// Expected output =  1.02

Actual result:
--
// Expected output =  1.2






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


Req #62397 [Com]: disable_functions = eval does not work

2012-06-28 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=62397&edit=1

 ID: 62397
 Comment by: anon at anon dot anon
 Reported by:spamik at yum dot pl
 Summary:disable_functions = eval does not work
 Status: Re-Opened
 Type:   Feature/Change Request
 Package:*General Issues
 PHP Version:5.3.14
 Block user comment: N
 Private report: N

 New Comment:

@e756937

(1) haven't you heard of include()?
(2) $_GET['path'] not validated
(3) no apparent rhyme or reason to mix of single and double quoting
(4) echo parameter neither quoted nor escaped
(5) echo within eval?
(6) why do you need eval for that at all?
(7) "I also use it for user auth" -- I completely doubt you need to.
(8) exec() is unrelated.
(9) The mere existence of an easy way to disable eval does not mean your host 
will do that. Your host can already disable it if they want to. Hosts often let 
you specify a custom php.ini or other configuration anyway, and this is 
certainly true on a server plan that serves 10k daily uniques for you.
(10) Using a 10minutemail.com address with a commenting system that doesn't 
verify the email.

Conclusion => magic_quotes level of IQ


Previous Comments:

[2012-06-26 17:59:39] e756937 at rtrtr dot com

I run a website with 10k uniques per day and eval() is CRUCIAL to my business

example:
$page = file_get_contents($_GET['path'].".php");
eval("echo ".$page.";");

I also use it for user auth and access to exec() since my host blocks it

As you can see, eval() is a very good thing to use and I don't want it gone, 
kk??


[2012-06-24 13:58:06] spamik at yum dot pl

good point about assert and preg_replace /e - there also should be option to 
disable it then (especialy this /e in preg_replace). Writers of malicious code 
so far did not had to use it because eval is enabled in every php version...
As for eval etc. documentation states that it sould be avoided by developers - 
and it is actualy. However it used to mask infected, malicious code by those 
that hacked php software. eval is commonly used to evaluate base64_encoded 
string and that makes very hard to see what code is doing and to detect it 
automaticly (by something like antivirus software).
Change on magic_quotes_gpc in php 5.4 is much greater change then turning off 
eval by default would be. Since most legitimate software don't use it (since 
documentation says its bad)would affect only very few. This also would not 
increase security. However it would make code infections so much easier to 
detect and analize its nature.


[2012-06-24 11:25:51] ni...@php.net

Irregardless of the FR, I'd like to point out that eval() is a useful and 
legitimate language construct. It *definitely* will not be disabled by default. 
I won't argue with the fact that it is commonly misused by ignorant developers, 
but this does not mean that eval() itself is in any way fundamentally "evil".

Also, I completely do not understand your arguments that people are migrating 
to other languages, because PHP has an eval() construct. All dynamic languages 
have an eval() function, including JS, Python and Ruby.

Furthermore you should realize that disabling eval() will not likely improve 
the security of your application. There are just to many other ways to execute 
code. E.g. the assert() function can be used to evaluate arbitrary code. Or the 
preg_replace /e modifier.

But in any case, I don't really see why eval() is a language construct. In my 
eyes it could just as well be a function. This would make it disableable and 
would also provide other advantages, like allowing its use as a callback 
function.


[2012-06-24 10:05:00] larue...@php.net

okey, change to FR makes sense to me.


[2012-06-24 04:08:24] spamik at yum dot pl

I think that that not only should be done but also made default php behavior, 
to 
stop widespread madness of php code infection. Eval should be by default 
disabled 
in php like 5.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=62397


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


Bug #62397 [Com]: disable_functions = eval does not work

2012-06-23 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=62397&edit=1

 ID: 62397
 Comment by: anon at anon dot anon
 Reported by:spamik at yum dot pl
 Summary:disable_functions = eval does not work
 Status: Not a bug
 Type:   Bug
 Package:*General Issues
 PHP Version:5.3.14
 Block user comment: N
 Private report: N

 New Comment:

A reason why a bug exists is not a reason why it is not a bug.


Previous Comments:

[2012-06-23 09:14:58] larue...@php.net

eval is not a function, if you want to disable it, you may refer to Suhosin 
thanks


[2012-06-23 07:28:04] reeze dot xia at gmail dot com

eval is not a function but language construct
http://php.net/eval so it cannot be disabled by adding it to disable_functions


[2012-06-23 00:24:50] spamik at yum dot pl

Description:

disable_functions = eval does not work.

eval is often used to obfucate code by malicious viruses. I see no reason why 
blocking access to eval() is not doable.







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


Bug #62175 [Com]: single quotes vs double quotes give different results with token_get_all

2012-05-28 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=62175&edit=1

 ID: 62175
 Comment by: anon at anon dot anon
 Reported by:iam4webwork at hotmail dot com
 Summary:single quotes vs double quotes give different
 results with token_get_all
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

You forgot to escape the $, so the variable got substituted into the string 
before tokens_get_all even saw it. Should be:

$tokens = token_get_all("';
$bar = 'bar'; // to avoid error notice
$tokens = token_get_all("https://bugs.php.net/bug.php?id=62175&edit=1


Bug #62086 [Com]: header() in 404 error page

2012-05-21 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=62086&edit=1

 ID: 62086
 Comment by: anon at anon dot anon
 Reported by:dave dot kimble at gmx dot com
 Summary:header() in 404 error page
 Status: Open
 Type:   Bug
 Package:Other web server
 Operating System:   Win 7 Ult 32
 PHP Version:5.4.3
 Block user comment: N
 Private report: N

 New Comment:

It looks like your error page is not configured to be interpreted as PHP, so 
everything from  is interpreted by the browser as a single HTML 
tag. Also the URL in your exit statement should be passed through 
htmlspecialchars to avoid an XSS vulnerability.


Previous Comments:

[2012-05-21 07:14:02] dave dot kimble at gmx dot com

Description:

I am trying to redirect all external links to pages in 
http://www.***.org.au/dave.kimble/ 
to http://www.davekimble.org.au/ 
by using header() in 404 error page.
Fastream IQWebFTPServer v11.5.5R possibly implicated.

If header() follows echo(), I expect error "headers already written".
Adding echo statements to debug, the output either doesn't appear, or after 
 output is the remaining script itself. 

Same problem with PHP 5.4.0

Test script:
---
Must be set in web server as Error Page 404

http://www.davekimble.org.au'.$restofuri );
exit('Redirecting you to http://www.davekimble.org.au'.$restofuri);
}
echo ($uri . ' not found');
?>


Expected result:

a) Browser URL: http://test-domain.com/dave.kimble/index.htm
   should return page http://www.davekimble.org.au/index.htm 
b) Browser URL: http://test-domain.com/.xxx
   should return "/.xxx not found"

Actual result:
--
a) Browser URL: http://test-domain.com/dave.kimble/index.htm
   returns blank page and response status 404
b) Browser URL: http://test-domain.com/.xxx
   returns '); ?> 
   which is the tail end of the script !






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


Bug #62045 [Com]: public access to a protected method

2012-05-16 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=62045&edit=1

 ID: 62045
 Comment by: anon at anon dot anon
 Reported by:gonzalo123 at gmail dot com
 Summary:public access to a protected method
 Status: Not a bug
 Type:   Bug
 Package:Class/Object related
 Operating System:   Linux
 PHP Version:5.3.13
 Block user comment: N
 Private report: N

 New Comment:

Here is another case which shows access granted based on class and not instance:

$a = new A();
$a->other = new A();
$a->foo();

class A {
var $other;

private function bar() {}

public function foo() {
$this->other->bar(); // okay to access private member of other 
instance of the same class
}
}

It's definitely a desirable feature in this case, because it allows public 
static factory methods with private constructors. I can't think of a simple use 
for the subclass protected access though.

The PHP manual states "Members declared protected can be accessed only within 
the class itself and by inherited and parent classes. Members declared as 
private may only be accessed by the class that defines the member." 
(http://php.net/manual/en/language.oop5.visibility.php), so this is at least 
working as documented. Note the terminology: "class", not "instance of class". 
Even if a rule change was desirable it couldn't be done without breaking 
backward compatibility.

I translated both code samples here to Java and C++ to get a second opinion, as 
it were. In Java, both are allowed (see here for the rule on protected access: 
http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.6.2.1). In 
C++, the second example with private access from the same class is allowed; 
however the protected example given in the original report is not ("error: 
'const char* AnotherClass::foo()' is protected").


Previous Comments:

[2012-05-16 14:21:36] cataphr...@php.net

read: "is the same in"


[2012-05-16 14:14:39] cataphr...@php.net

Right. But it doesn't change anything. The type is only important to decide 
what the foo() method is, and foo() is AnotherClass and OneClass.


[2012-05-16 13:15:57] gonzalo123 at gmail dot com

$this->object is not an instance of OneClass. 
$this->object is an instance of AnotherClass (look at the constructor).


[2012-05-16 11:36:49] cataphr...@php.net

$this->object is an instance of OneClass. $this->object->foo() is called. foo() 
is protected and was defined in the context of OneClass. The access is done in 
the context of AnotherClass.  AnotherClass is a subclass of OneClass (the 
context where foo() was defined). Therefore access is granted. I don't know 
what's your problem here.


[2012-05-16 09:00:32] gonzalo123 at gmail dot com

But we are not accesing OneClass::foo. This access is allowed beacause of the 
extends,we should not have access to use $this->object->foo();

$this is an instance of OneClass (it extends AnotherClass) but $this->object 
(we 
load it with DI) is an instance of AnotherClass. foo is protected here and we 
are 
accesing as a public method.




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=62045


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


Bug #62032 [Com]: filter_var incorrectly strips characters from strings after "<"

2012-05-15 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=62032&edit=1

 ID: 62032
 Comment by: anon at anon dot anon
 Reported by:iamcraigcampbell at gmail dot com
 Summary:filter_var incorrectly strips characters from
 strings after "<"
 Status: Open
 Type:   Bug
 Package:Filter related
 Operating System:   Mac OS X
 PHP Version:5.4.3
 Block user comment: N
 Private report: N

 New Comment:

Well I never heard of this "SANITIZE_STRING" filter before, but it looks just 
as retarded as it sounds, and about as retarded as strip_tags. 99.99% of the 
time, strip_tags just should not be used at all because it's horribly broken. 
The real bugs are (1) strip_tags exists, and (2) that PHP should imply that any 
kind of magical all-purpose "string sanitization" process could exist.

@iamcraigcampbell:
>Well I can understand stripping it if there is a closing > somewhere, but if 
>it is 
a < that is not followed by a matching > then it should be allowed in the 
string 
and not stripped.
In that case:
(1) Unclosed tags will eat extra page content, breaking page layout.
(2) Pages consist of many echo statements. By your logic, "", we need 
to implement a delayed-choice quantum eraser to make all the parallel universes 
in which the earlier echo statement occurred cease to exist.

>I think it is more expected behavior to display this string as "This is NOT 
>good!".
No. Display what users type. Don't delete text from their posts based on the 
quirks of what just happens to be the underlying display format on a particular 
day. Suppose your hypothetical forum also displays posts in another format, 
e.g., it has a Flash or iPhone-based app, or it tweets posts, or a few years 
from now we're all using a completely different markup language. Should it then 
also strip HTML-like tags from all text in perpetuity from all media just 
because HTML happened to be a relevant format to someone somewhere once upon a 
time, or should user-submitted text throw integrity to the wind and change 
depending on what kind of device someone is attempting to use to view it, 
whether or not that device's markup was invented when the post was made? What 
if someone is trying to use text that legitimately resembles an HTML tag (it 
happens), or, more likely, they're trying to quote or talk about HTML -- no 
filter can handle this. No no no no no. Display what they type and don't 
confuse the poor souls. I.e., use htmlspecialchars() if outputting to HTML; or 
if not, use whatever other escaping method is appropriate to the particular 
output format that still preserves the integrity of the user-typed text in that 
format, while making exception for the formatting markup that is legitimately 
supported and documented to be supported by the forum, such as markdown or 
bbcode syntax (and probably not HTML, since besides the fact that HTML is ugly 
and over-complicated for most forum post needs, strip_tags with an allowed tags 
parameter is the most dangerous of the lot and allows blatant abuse via 
attributes).

And don't get me started on entities.

tl;dr: no amount of wrapping it in flashy filter functions changes the fact 
that strip_tags confuses countless souls, is brain-damaged, and ought to be 
deprecated to death.


Previous Comments:

[2012-05-15 15:06:26] iamcraigcampbell at gmail dot com

@pajoye I agree with you, but there is a use case that encoding will not solve.

Let's say there is a forum where users are posting.  If the user posts:

"This is NOT good!" and the tags get encoded then that means 
the 
HTML tags will be displayed in the forum as plain text.  I think it is more 
expected 
behavior to display this string as "This is NOT good!".

So one option would be encoding the < only if it is not followed by a > but 
that is a 
lot of extra work to figure that out.


At the end of the day the point is that no matter how you look at it I still 
think 
this is a bug.

$string = 'This is true: 2<5';
strip_tags($string); and filter_var($string, FILTER_SANITIZE_STRING);

Should not strip out <5 since that is not an HTML tag.


[2012-05-15 14:51:09] aleksey dot v dot korzun at gmail dot com

How is stripping anything after < with a space is a valid operation? That seems 
like a lazy man's html stripper.

Let's just blindly strip everything that can possibly be made into an html tag 
of 
any sort. Not.


[2012-05-15 14:49:02] paj...@php.net

> or < should be encoded then, see 

http://www.php.net/manual/en/filter.filters.sanitize.php

btw, any opt

Req #61954 [Com]: Multi-CASE line for SWITCH

2012-05-05 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61954&edit=1

 ID: 61954
 Comment by: anon at anon dot anon
 Reported by:dm at dmillerweb dot com
 Summary:Multi-CASE line for SWITCH
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   N/A
 PHP Version:5.4.2
 Block user comment: N
 Private report: N

 New Comment:

Several other languages do support fancier rules in their switch statements, 
though. One variant of the B language (B being the language which first devised 
the current syntax for the switch statement) allowed ranges such as "case 1 :: 
10" and comparisons such as "case >= 5". Most BASICs allow ranges ("CASE 1 TO 
10"), comparisons ("CASE IS < 5"), and comma-separated values ("CASE 2, 4, 6"). 
Ruby allows comma separated values ("when 2, 4, 6") and ranges ("when 1..10").

It would be useful if PHP supported some of those features.


Previous Comments:
------------
[2012-05-05 21:45:02] anon at anon dot anon

The standard way to accept multiple case values (in all C-like languages, 
including PHP) is to put multiple case labels. It's not quite as succinct as 
your example, but it does fulfill the purpose of allowing you to only write the 
handlers once:

switch ($color) {
   case "blue":
   case "green":
   case "aqua":
  echo $color . " is a cool color.";
  break;
   case "red": case "orange": case "brown":
  echo $color . " is a warm color.";
  break;
}

Adding { } around those sections is actually already valid syntax, though in 
PHP it does nothing because PHP doesn't have block scope 
(https://en.wikipedia.org/wiki/Scope_%28computer_science%29#Block_scope_within_a_function).
 In some similar languages, that syntax delimits a scope but doesn't imply a 
"break;", so PHP could only add that new logic if it's willing to confuse 
people. It would also break backwards compatibility with any odd code that 
already has extra { } in its switch handlers.


[2012-05-05 20:23:47] dm at dmillerweb dot com

Description:

---
>From manual page: http://www.php.net/control-structures.switch
---
I did not see this capability on the manual page, so please forgive me if such 
an improvement is already in the works.

I believe it would be a great help to upgrade the SWITCH -> CASE statements so 
they accept multiple values. This would allow us to write only one block of 
code-to-be-executed even for multiple values.

Here's an example:

switch ($color) {
   case: "blue", "green", "aqua"
  echo $color . " is a cool color."
  break;
   case: "red", "orange", "brown"
  echo $color . " is a warm color."
}

Also, we could eliminate the need for the BREAK statement by allowing code 
after the CASE statement to be enclosed in braces; the closing brace for that 
code would indicate an automatic BREAK.

Hope this helps.

David Miller








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


Req #61954 [Com]: Multi-CASE line for SWITCH

2012-05-05 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61954&edit=1

 ID: 61954
 Comment by: anon at anon dot anon
 Reported by:dm at dmillerweb dot com
 Summary:Multi-CASE line for SWITCH
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   N/A
 PHP Version:5.4.2
 Block user comment: N
 Private report: N

 New Comment:

The standard way to accept multiple case values (in all C-like languages, 
including PHP) is to put multiple case labels. It's not quite as succinct as 
your example, but it does fulfill the purpose of allowing you to only write the 
handlers once:

switch ($color) {
   case "blue":
   case "green":
   case "aqua":
  echo $color . " is a cool color.";
  break;
   case "red": case "orange": case "brown":
  echo $color . " is a warm color.";
  break;
}

Adding { } around those sections is actually already valid syntax, though in 
PHP it does nothing because PHP doesn't have block scope 
(https://en.wikipedia.org/wiki/Scope_%28computer_science%29#Block_scope_within_a_function).
 In some similar languages, that syntax delimits a scope but doesn't imply a 
"break;", so PHP could only add that new logic if it's willing to confuse 
people. It would also break backwards compatibility with any odd code that 
already has extra { } in its switch handlers.


Previous Comments:

[2012-05-05 20:23:47] dm at dmillerweb dot com

Description:

---
>From manual page: http://www.php.net/control-structures.switch
---
I did not see this capability on the manual page, so please forgive me if such 
an improvement is already in the works.

I believe it would be a great help to upgrade the SWITCH -> CASE statements so 
they accept multiple values. This would allow us to write only one block of 
code-to-be-executed even for multiple values.

Here's an example:

switch ($color) {
   case: "blue", "green", "aqua"
  echo $color . " is a cool color."
  break;
   case: "red", "orange", "brown"
  echo $color . " is a warm color."
}

Also, we could eliminate the need for the BREAK statement by allowing code 
after the CASE statement to be enclosed in braces; the closing brace for that 
code would indicate an automatic BREAK.

Hope this helps.

David Miller








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


Bug #61788 [Com]: error_reporting expression sequence problem

2012-04-24 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61788&edit=1

 ID: 61788
 Comment by: anon at anon dot anon
 Reported by:wangrj at infobird dot com
 Summary:error_reporting expression sequence problem
 Status: Not a bug
 Type:   Bug
 Package:*Configuration Issues
 Operating System:   CentOS 5.4
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

You misspelled E_NOTICE.


Previous Comments:

[2012-04-21 14:31:18] larue...@php.net

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

~E-NOTICE => ~intval(E-NOTICE) => ~0 => -1


[2012-04-20 14:51:54] wangrj at infobird dot com

error_reporting = E_ALL & ~E-NOTICE & ~E_DEPRECATED does not take effect means

still reporting notice and deprecated errors


[2012-04-20 14:36:11] wangrj at infobird dot com

Description:

the error_reporting expression in php.ini has a very strange probelm

if you want to report all types of errors info except notice and deprecated

the following expression for error_reporting does not take effect: 

error_reporting = E_ALL & ~E-NOTICE & ~E_DEPRECATED

but the following is ok

error_reporting = E_ALL & ~E_DEPRECATED & ~E-NOTICE


Besides if any notice or deprecated error has generated and reported,  you got 
HTTP 500 error under nginx when display_error = off










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


Bug #61792 [Com]: preg_replace_callback memory leak

2012-04-20 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61792&edit=1

 ID: 61792
 Comment by: anon at anon dot anon
 Reported by:tshaw at oitc dot com
 Summary:preg_replace_callback memory leak
 Status: Not a bug
 Type:   Bug
 Package:PCRE related
 Operating System:   OSX 10.7.3
 PHP Version:5.4.0
 Block user comment: N
 Private report: N

 New Comment:

@tshaw: The problem is that create_function is a nasty old construct that adds 
a new function every time you call it, even if the code to compile is the same 
each time. The created functions are *permanent* and create_function returns 
their name only -- so even if the variable containing their name goes out of 
scope, the created functions persist. Naturally, 10 million functions take a 
lot of memory. It's not technically a bug, just awful language design.

You can create the functions once statically and store their names, or since 
PHP 5.3.0, you can use anonymous functions instead. Try this:

function urlDecodeUnreservedChars( $string ) {
$unreserved = array();
$unreserved[] = dechex( ord( '-' ) );
$unreserved[] = dechex( ord( '.' ) );
$unreserved[] = dechex( ord( '_' ) );
$unreserved[] = dechex( ord( '~' ) );
return preg_replace_callback(
array_map(function ($str) { return '/%' . strtoupper($str) . 
'/x'; }, $unreserved),
function ($matches) { return chr(hexdec($matches[0])); }, 
$string
);
}


Previous Comments:

[2012-04-20 22:45:09] tshaw at oitc dot com

I am totally confused. 

You say that its OK for PHP to fail with a memory exhausted error when running 
a 
perfectly valid CLI script that happens to fail on the 180951 iteration? I say 
this is absolutely bug!  

There may be no memory leak but it surely is a bug as a CLI script that 
iterates 
a long period of time is not out of line.

I respectfully request you reconsider and change this back to a bug.


[2012-04-20 22:24:28] fel...@php.net

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

There is no memory leak, what happens is that the memory associated to the 
lambda functions (via create_function()) is just released in the end of 
execution.


[2012-04-20 21:40:54] tshaw at oitc dot com

Description:

$ ./ptest.php
Test preg_replace_callback
Iteration number 0
Iteration number 1

Iteration number 180951
PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to 
allocate 3072 bytes) in /Users/tshaw/Sites/surbl/ptest.php(11) : 
runtime-created 
function on line 1

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to 
allocate 
3072 bytes) in /Users/tshaw/Sites/surbl/ptest.php(11) : runtime-created 
function 
on line 1


Test script:
---
#!/usr/local/php5/bin/php



Expected result:

Expected it to run to completion

Actual result:
--
PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to 
allocate 3072 bytes) in /Users/tshaw/Sites/surbl/ptest.php(11) : 
runtime-created 
function on line 1

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to 
allocate 
3072 bytes) in /Users/tshaw/Sites/surbl/ptest.php(11) : runtime-created 
function 
on line 1







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


Bug #61747 [Com]: User-defined error handler run despite at sign (@) error control operator

2012-04-17 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61747&edit=1

 ID: 61747
 Comment by: anon at anon dot anon
 Reported by:chealer at gmail dot com
 Summary:User-defined error handler run despite at sign (@)
 error control operator
 Status: Not a bug
 Type:   Bug
 Package:*General Issues
 PHP Version:5.4.0
 Block user comment: N
 Private report: N

 New Comment:

What a lot of fuss about nothing.


Previous Comments:

[2012-04-17 02:06:55] chealer at gmail dot com

No what? It's not fine not to treat suppressed errors differently?


[2012-04-17 02:00:40] ras...@php.net

No, I think a custom error handler should make good use of the silence 
operator. 
There are all kinds of interesting things you can do with it. But yes, if you 
want to ignore it entirely, that is fine too.


[2012-04-17 01:40:34] chealer at gmail dot com

Right. So, the documentation is saying custom error handlers should treat 
suppressed errors differently. You are saying it is fine not to do that.
I think your version is right.


[2012-04-17 00:59:34] ras...@php.net

Right, it says "should" not "must". If you choose to not treat @ differently, 
then you obviously don't need to call error_reporting() from your handler.


[2012-04-17 00:36:29] chealer at gmail dot com

You write:
If you choose to treat @-preceded errors like any other error, that's fine.

Yet http://ca3.php.net/manual/en/language.operators.errorcontrol.php says a 
custom error handler should call error_reporting().
So why should a custom error handler which chooses to treat @-preceded errors 
like any other error call error_reporting()?

You write:
By default PHP ignores errors from calls preceded by @, but since you are 
writing your own you should have the power to override any and all such 
defaults.

I'm not sure I would say that custom error handlers *should* have the power to 
override error suppression, but I certainly understand that it can be useful. 
In any case, offering that flexibility doesn't have to make it more complicated 
to write a simple custom handler. set_error_handler() could simply have an 
argument to control whether the callback is called even on normally suppressed 
errors.




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=61747


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


Req #61382 [Com]: need a function class_rename

2012-03-14 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61382&edit=1

 ID: 61382
 Comment by: anon at anon dot anon
 Reported by:todesw1nd at hotmail dot com
 Summary:need a function class_rename
 Status: Open
 Type:   Feature/Change Request
 Package:SPL related
 Operating System:   independent
 PHP Version:5.4.0
 Block user comment: N
 Private report: N

 New Comment:

You don't need this. Give all the derived (wrapper) car classes different 
names, then stick the name of the selected car in a string variable and 
instantiate it from the variable.

$class_name = 'Sports_Car';
...
$car1 = new $class_name;


Previous Comments:

[2012-03-14 06:40:23] todesw1nd at hotmail dot com

tiny error in code example:

class Wrapper_Car extends Base_Car <- this should be more correct

the class name for all "real" cars is Wrapper_Car, even if i buy a third one


[2012-03-14 06:37:12] todesw1nd at hotmail dot com

Description:

this is OOP related and maybe targets to AOP.

Since i found a quick & dirty solution for myself using eval() in my framework 
it is not urgent, but would be nice to have to no longer need it as it is not 
used on any other parts currently.

The problem itself:

Lets say we have two cars and don't care about which one we drive, we just want 
to use one of it and a friend should decide which one by selecting it.

In PHP i now have to use a wrapper class for each of the two cars with the same 
name, e.g. Wrapper_Car and a base class that is extended with their 
functionality, e.g. Base_Car. I do have a mess now as different cars can't have 
the same file name due to the default autoloader.

Test script:
---
file base_car.php:

abstract class Base_Car
{
abstract public function drive();
}

file wrapper_car1.php:

class Wrapper_Car
{
public function drive
{
// Lets drive it ^^
}
}

file wrapper_car2.php:

same content as wrapper_car1.php but slightly other implementation inside the 
methods of the class

Expected result:

I would like to have a function like this:

class_rename($class_name, $class_newname);

So i can autoload the car class i want to use, e.g. wrapper_car1.php and have 
the class called Wrapper_Car1 and then rename it to Wrapper_Car as it is the 
selected car i want to drive with.

Important: It would be ok if the autoloader tries to load the first param 
$class_name if it does not exist, but it should never ever do it for the second 
parameter as e.g. class_alias does it currently and is therefore useless for 
this case.

Actual result:
--
As said before i currently use a one liner eval that sets the namespaces and 
creates the renamed class based on the earlier loaded one to emulate this 
behavior and i think that is little dirty :]

Thanks for reading this and it would be awesome to have such a functionality in 
a later PHP version. If you see it from another point of view it would be nice 
to see why.






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


Bug #61293 [Com]: assigning 09 to variable

2012-03-05 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61293&edit=1

 ID: 61293
 Comment by: anon at anon dot anon
 Reported by:donmillhofer at yahoo dot com
 Summary:assigning 09 to variable
 Status: Not a bug
 Type:   Bug
 Package:Variables related
 Operating System:   Windows Vista
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

It's been a bug for 10+ years. To this day nobody at PHP is smart enough to 
turn it into a syntax error condition, like it would be in a good or semi-good 
language.


Previous Comments:

[2012-03-05 18:53:54] ras...@php.net

Yes, you have discovered octal notation.

http://www.php.net/manual/en/language.types.integer.php


[2012-03-05 18:24:52] donmillhofer at yahoo dot com

Description:

My concern is that PHP treats the handling of variable assignment 
inconsistently.  For example if I assign 01 to a variable $i01 the result will 
be an int 1, the same as if I had assigned 1 to the variable.  This works for 
values of 01,02,03,04,05,06, and 07.  However 08 and 09 are assigned as 0!

See repeatable test below.



Test script:
---
Assign variables:
$s09 = '09';
$c09 = (integer) '09';
   $i09 = 09;

Result of var_dump($s09.' / '.$c09.' / '.$i09);
string '09 / 9 / 0'

Assign variables:
$s07 = '07';
$c07 = (integer) '07';
   $i07 = 07;

Result of var_dump($s07.' / '.$c07.' / '.$i07);
string '07 / 7 / 7'

And when I just dump the $iXX variable I get:

var_dump($i09);
Result  int 0

var_dump($i07);
Result  int 7

This looks like a bug to me. 







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


Req #61255 [Com]: Unserialize should handle incorrect or missing string-length

2012-03-02 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61255&edit=1

 ID: 61255
 Comment by: anon at anon dot anon
 Reported by:mi+php at aldan dot algebra dot com
 Summary:Unserialize should handle incorrect or missing
 string-length
 Status: Open
 Type:   Feature/Change Request
 Package:*Data Exchange functions
 Operating System:   All
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

It depends on the lengths because the strings aren't escaped. serialize('"') = 
s:1:""";


Previous Comments:

[2012-03-02 22:26:46] mi+php at aldan dot algebra dot com

Description:

A serializing string "foo" produces an intuitive result 's:3:"foo"' and 
unserialize() properly decodes that back.

It would be useful, however, if the unserialize function could handle (even if 
less efficiently) cases, where the string-length is missing or even specified 
incorrectly. Currently any such mismatches result in empty output from the 
function, even though `s:"foo"' or `s::"foo"' or even `s:4:"foo"' is no harder 
to understand.

The feature would be of help to those of us, who need to a massive 
search/replace in the dump of serialized objects.

Test script:
---
" . unserialize($s1) . "<\n";
print "S2: >" . unserialize($s2) . "<\n";
print "S3: >" . unserialize($s3) . "<\n";
print "S4: >" . unserialize($s4) . "<\n";
?>


Expected result:

S1: >1234567<
S2: >1234567<
S3: >1234567<
S4: >1234567<


Actual result:
--
S1: >1234567<
S2: ><
S3: ><
S4: ><







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


Bug #61220 [Com]: is_numeric returns FALSE for chr(0) and CHR(1) that are BIT, so NUMERIC.

2012-03-01 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61220&edit=1

 ID: 61220
 Comment by: anon at anon dot anon
 Reported by:dosergio at ig dot com dot br
 Summary:is_numeric returns FALSE for chr(0) and CHR(1) that
 are BIT, so NUMERIC.
 Status: Not a bug
 Type:   Bug
 Package:*General Issues
 Operating System:   ALL
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

@dosergio

Chr is a PHP function that returns a string with the specified character code. 
Try this:

var_dump(chr(0));

It says:

string(1) " "

It's a string, and not a string containing a human-readable number, so 
is_numeric returns false as it says it will do in the documentation.

>numeric in the binary context

Everything is numeric in the "binary context". If is_numeric returned true for 
that reason, then it should be hard-wired to return true always, because you 
cannot possibly pass it an argument which is not made of bits.

>Tell the MySQL team that they are wrong, because they are storing chr(0) and 
>chr(1) for bit(1) values.

I won't say that they're wrong, but they're definitely different to all other 
databases in this way. Read: 
http://www.xaprb.com/blog/2006/04/11/bit-values-in-mysql/

For some reason, new versions of MySQL return BIT columns to clients as strings 
instead of integers. To avoid the problems this causes, you could do one of the 
following:
(a) use an integer column instead (e.g., TINYINT(1) instead of a BIT(1))
(b) put +0 in the SQL expression, which forces the bit value to be returned as 
a number
(c) use the PHP ord() function to convert the character into its character code.

In any case, it's not a PHP bug.


Previous Comments:

[2012-03-01 18:22:27] ras...@php.net

Yes, binary is 0's and 1's at the low level. So is octal, decimal and 
hexadecimal 
or anything else you represent digitally. What matters here is the character 
representation of these numbers. The character representation of binary (as of 
PHP 5.4) is 0b0101 (for example). Just like 05 is octal, 5 is decimal and 0x05 
is 
hexadecimal. All of these make is_numeric() return true.


[2012-03-01 16:26:11] dosergio at ig dot com dot br

Do you know the binary numeric system ?
Chr(0) is the octet  which value is 0, so it's NOT different from zero.
Chr(1) is the octet 0001 which value is 1, NOT different from the numeric 1.

These two chars should ALSO be recognized as boolean in the "is_bool" function 
too. Everybody that program in C knows that 0 and 1 are the real booleans 
inside the engine.

If you are so sure, take the chance, and tell the MySQL team that they are 
wrong, because they are storing chr(0) and chr(1) for bit(1) values. 
Bit is defined as numeric data type in MySQL


[2012-03-01 15:45:58] ras...@php.net

No, definitely not. chr(0) is a NUL which is distinct from the number 0 and 
chr(1) is a SOH character which has absolutely nothing to do with a number.


[2012-03-01 15:02:02] dosergio at ig dot com dot br

I also tested chr(0) and chr(1) with is_boolean and of course the function says 
it is not.
I think is_numeric and is_boolean should be revised to include 0, 1, chr(0) and 
chr(1) as valid numeric and valid booleans.


[2012-03-01 14:13:56] dosergio at ig dot com dot br

if( is_numeric( chr(0)) && is_numeric(chr(1)) )  # <-- changed to &&
echo "is_numeric is great!";
 else
echo "is_numeric might be a little buggy";




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=61220


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


Bug #61214 [Com]: puzzled replace when replacement contains "="

2012-03-01 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61214&edit=1

 ID: 61214
 Comment by: anon at anon dot anon
 Reported by:58219758 at qq dot com
 Summary:puzzled replace when replacement contains "="
 Status: Not a bug
 Type:   Bug
 Package:PCRE related
 Operating System:   windows 7
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

This is happening because of the fourth search expression /\w+\=([^=]+)/. It 
matches the previous replacements and removes them. Without it, this:

echo preg_replace(
array('/required/', '/min\=(\d+)/', '/max\=(\d+)/'),
array('R=1', 'R="$1"', 'R="$1"'),
'required min=3 max=5 code=code'
) . "\n";

Outputs:

R=1 R="3" R="5" code=code

(As expected.) But the replacements happen one after the other instead of 
simultaneously, so then it will do the equivalent of this:

echo preg_replace(
'/\w+\=([^=]+)/',
'',
'R=1 R="3" R="5" code=code'
) . "\n";

..which will match and remove 'R=1 R' and 'R="5" code', producing the 
"puzzling" output:

="3" =code

Here is one way to solve it, by doing all the matches simultaneously with one 
regexp:

echo preg_replace_callback(
'/(\w+)(?:=(\S+))?/',
function ($parts) {
if (!empty($parts[2])) { // have '='
if ($parts[1] == 'min' || $parts[1] == 'max') {
return 'R="' . $parts[2] . '"';
} else {
return '';
}
} else {
if ($parts[1] == 'required') {
return 'R=1';
} else {
return $parts[0]; // unmodified
}
}
},
'required min=3 max=5 code=code'
) . "\n";

This outputs:

R=1 R="3" R="5"


Previous Comments:

[2012-03-01 10:03:08] 58219758 at qq dot com

$search = array(
'/required/',
'/min\=(\d+)/',
'/max\=(\d+)/',
'/\w+\=([^=]+)/',
);
$replace2 = array(
'R=1',
'R="$1"',
'R="$1"',
);
in this case, the result is still ="3" =code


[2012-03-01 09:59:23] 58219758 at qq dot com

"=" will be quoted to "\=", in this case, the result is R\=1 R\="3" R\="5" too, 
whenever "\=" or "\\=".


[2012-03-01 08:35:04] ras...@php.net

This is not a bug. '=' has special meaning in ?= and ?<= expressions and it is 
on 
the list of characters quotes by preg_quote.


[2012-03-01 08:25:13] 58219758 at qq dot com

Description:

$search = array('/required/','/min\=(\d+)/','/max\=(\d+)/','/\w+\=([^=]+)/',);
$replace2 = array('R=1','R="$1"','R="$1"',);
It seems doesn't work correctly when replacement contains "="

Test script:
---
$search = array('/required/','/min\=(\d+)/','/max\=(\d+)/','/\w+\=([^=]+)/',);
$replace1 = array('R1','R"$1"','R"$1"',);
$replace2 = array('R=1','R="$1"','R="$1"',);
$replace3 = array('R\\=1','R\\="$1"','R\\="$1"',);
$from = 'required min=3 max=5 code=code';
echo preg_replace($search, $replace1, $from);
echo preg_replace($search, $replace2, $from);
echo preg_replace($search, $replace3, $from);

Expected result:

R1 R"3" R"5"
R=1 R="3" R="5"
R\=1 R\="3" R\="5"

Actual result:
--
R1 R"3" R"5"
 ="3" =code
R\=1 R\="3" R\="5"






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


Bug #61095 [Com]: PHP can't add hex numbers

2012-02-15 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61095&edit=1

 ID: 61095
 Comment by: anon at anon dot anon
 Reported by:tomek at przeslij dot pl
 Summary:PHP can't add hex numbers
 Status: Open
 Type:   Bug
 Package:Math related
 Operating System:   Windows XP
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

That is fan-tastic!

http://i.imgur.com/uPC2b.gif


Previous Comments:

[2012-02-15 15:32:20] tomek at przeslij dot pl

Description:

These echoes 4:
echo (0x00+2);
echo (0x00+0x02);
but they should echo 2! This echoes 2 as expected:
echo (0x00 + 2);

Test script:
---
echo (0x00+2);

Expected result:

2

Actual result:
--
4






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


Bug #61049 [Com]: Fopen detects non existing file

2012-02-10 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61049&edit=1

 ID: 61049
 Comment by: anon at anon dot anon
 Reported by:kasper at webmasteren dot eu
 Summary:Fopen detects non existing file
 Status: Not a bug
 Type:   Bug
 Package:Filesystem function related
 Operating System:   windows
 PHP Version:5.3.8, 5.3.9
 Block user comment: N
 Private report: N

 New Comment:

Sadly this is a Windows limitation. On Windows you cannot create a file named 
"con", "aux", "prn", or "nul", regardless of case. They are reserved device 
names that exist for historical reasons ("con" for example is the 
stdin/stdout). For some mad reason, this limitation still applies regardless of 
the file extension!! Try simply in Notepad to save a file called con.txt and 
it'll fail just the same.


Previous Comments:

[2012-02-10 20:32:57] cataphr...@php.net

This is a Win32 quirk. The interface PHP uses has problems with files named 
CON, 
among others:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

«Do not use the following reserved device names for the name of a file:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, 
LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names 
followed immediately by an extension; for example, NUL.txt is not recommended. 
For more information, see Namespaces.»


[2012-02-10 19:28:55] kasper at webmasteren dot eu

realized the version was wrong (the date)


[2012-02-10 19:27:37] kasper at webmasteren dot eu

Description:

Tested under PHP version 5.3.8 and 5.3.9, both running xdebug and a lot of 
other 
standard plugins.
The problem is for some reason that PHP simply cannot create / open a file 
named 
"../api/cache/con.js" which seems rather strange,since there is no keywords 
(from what i could find) there would even suggest that it could be the reason. 
i have used the software packet called "wamp". 

Configuration line:
cscript /nologo configure.js "--enable-snapshot-build" "--with-pdo-oci=C:\php-
sdk\php53dev\vc9\x64\deps\instantclient_10_2\sdk,shared" "--with-oci8=C:\php-
sdk\php53dev\vc9\x64\deps\instantclient_10_2\sdk,shared" "--with-oci8-
11g=C:\php-sdk\php53dev\vc9\x64\deps\instantclient_11_2\sdk,shared" "--disable-
debug-pack" "--disable-static-analyze"

the version API:
API20090626,TS,VC9


The test script:
inside af subfolder, on a webserver, put this, and make sure that ../api/cache 
folder exists.

futher more, when using the SplFileInfo the method "getType" tells me that it 
is 
a file. the method "getAbsolutePath" returns "c:\wamp\www\api\cache\CON" and 
the 
"getFileName" returns "CON.js". 

Test script:
---
fopen("../api/cache/con.js","w");


Expected result:

Warning: fopen(../api/cache/con.js) [function.fopen]: failed to open stream: 
Bad 
file descriptor in C:\wamp\www\teater\indexa.php on line 3



Actual result:
--
Warning: fopen(../api/cache/con.js) [function.fopen]: failed to open stream: 
Bad 
file descriptor in C:\wamp\www\teater\indexa.php on line 3







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


Bug #61044 [Com]: invalid PHP_BINDIR

2012-02-10 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61044&edit=1

 ID: 61044
 Comment by: anon at anon dot anon
 Reported by:bugzilla33 at gmail dot com
 Summary:invalid PHP_BINDIR
 Status: Open
 Type:   Bug
 Package:Unknown/Other Function
 Operating System:   win 7
 PHP Version:5.4.0RC7
 Block user comment: N
 Private report: N

 New Comment:

He's right. This seems to be totally broken on Windows:

C:\>server\php\php.exe --version
PHP 5.3.2 (cli) (built: Mar  3 2010 19:40:13)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

C:\>server\php\php.exe -r "echo PHP_BINDIR";
C:\php5


Previous Comments:

[2012-02-10 13:42:02] bugzilla33 at gmail dot com

Description:

Install php in folder c:\Php5
As module apache

Test script:
---


Expected result:

c:\Php5

Actual result:
--
c:\Php






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


Bug #61012 [Com]: filter_var don't pass valid email address

2012-02-08 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61012&edit=1

 ID: 61012
 Comment by: anon at anon dot anon
 Reported by:sucotronic at gmail dot com
 Summary:filter_var don't pass valid email address
 Status: Not a bug
 Type:   Bug
 Package:Mail related
 Operating System:   linux ubuntu 10.04
 PHP Version:5.3SVN-2012-02-08 (snap)
 Block user comment: N
 Private report: N

 New Comment:

I also get false, using PHP 5.3.2/Windows.

But according to the change log, FILTER_VALIDATE_EMAIL was overhauled in PHP 
5.3.3, in July 2010, after this bug report: 
https://bugs.php.net/bug.php?id=49576


Previous Comments:

[2012-02-08 17:55:28] sucotronic at gmail dot com

More exactly, my version is: 5.3.2-1ubuntu4.11


[2012-02-08 16:49:29] ras...@php.net

Unable to reproduce in 5.3/5.4:

php > echo filter_var("+4654651...@test.com", FILTER_VALIDATE_EMAIL);
+4654651...@test.com

Make sure you are actually trying this in 5.3. This may have been broken in 
5.2, 
but was fixed years ago in 5.3.


[2012-02-08 14:58:45] sucotronic at gmail dot com

Description:

If you use the filter_var function to test an email address, and the address 
starts with the '+' sign, it's marked as invalid, but it isn't.

Test script:
---
filter_var("+4654651...@test.com", FILTER_VALIDATE_EMAIL)

Expected result:

Return the string and not false.

Actual result:
--
false






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


Bug #61001 [Com]: Corruption of "=0a" but not "=a0"

2012-02-07 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=61001&edit=1

 ID: 61001
 Comment by: anon at anon dot anon
 Reported by:mike at eastghost dot com
 Summary:Corruption of "=0a" but not "=a0"
 Status: Open
 Type:   Bug
 Package:PCRE related
 Operating System:   Ubuntu LAMP
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

Not a bug and it has nothing to do with UTF8. The error message says why it's 
not working: the eval'd code has a syntax error, because you forgot to wrap the 
argument to debdcode_post in quotes. It should be:

$html_oursr[0] = 'debdcode_post(\'$1\')';

It works for `debdcode_post(a0)` because a0 is parsed as a constant (if you do 
`error_reporting(-1);` you will see the notice about the use of the undefined 
constant), but `debdcode_post(0a)` is always a syntax error.

But the better (faster) solution is to use preg_replace_callback.


Previous Comments:

[2012-02-07 10:10:23] mike at eastghost dot com

Description:

Passing following UTF8 text thru 3rd line of the test script (i.e., 
preg_replace() function) causes an error in preg_replace function:

[post=0a /]

Whereas, passing following UTF8 text similarly causes no error:

[post=a0 /]

Problem seems to be caused only when the "=" is followed by an integer then 
followed by a letter.  I briefly tried other combinations without causing error.

Workaround is to replace third line of test script with this line (i.e., use 
the 
preg_replace_callback() instead of preg_replace()

$out = preg_replace_callback( '@\[p(?:ost){0,1}=(.{1,24})\ {0,}\/\]@Uiu', 
'debdcode_post', $i_html );




Test script:
---
$html_ours[0] = '@\[p(?:ost){0,1}=(.{1,24})\ {0,}\/\]@Uieu';

$html_oursr[0] = 'debdcode_post( $1 )'; // irrelevant, use any misc func that 
looks up post id in db

$out = preg_replace( $html_ours, $html_oursr, $i_html );

Expected result:

The general use is in a BBCODE-like parser for use in a FORUMS app.

What should happen:

In the source text (in UTF-8 format),

the string "[post=4ablahblah /]"

should be picked out of any given arbitrary input

by the preg_replace()

and then translated to a hyperlink

by the debdcode_post().  What is happening instead is the error in 
preg_replace, 
presumably from malformed UTF-8 or possibly a bug inside preg_replace when 
dealing with the particular character sequence "=.  Note that it's the "=" followed by an integer and then followed 
by 
at least one letter and/or more integers that triggers the error.  I hope this 
helps; thank you for looking.

Actual result:
--
Parse error: syntax error, unexpected T_STRING in 
/apath/Class/common_functions.inc(1405) : regexp code on line 1

Fatal error: preg_replace() [function.preg-
replace]: Failed evaluating code: debdcode_post( 4f30abfddc7959547420 ) 
in 







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


Bug #60992 [Com]: Trim / rtrim bug when we need to delete extension

2012-02-06 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60992&edit=1

 ID: 60992
 Comment by: anon at anon dot anon
 Reported by:elie29 at gmail dot com
 Summary:Trim / rtrim bug when we need to delete extension
 Status: Open
 Type:   Bug
 Package:Strings related
 Operating System:   windows
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

This is the correct logic for the trim functions. As stated in the 
documentation, the second parameter is a list of characters, not a solid string 
to test for verbatim. Hence `rtrim('users.php', 'ph.'))` is also 'users'. Try 
something like this instead:

function rtrim_str($str, $fragment) {
if (substr($str, -strlen($fragment)) === $fragment) $str = substr($str, 
0, -strlen($fragment));
return $str;
}


Previous Comments:

[2012-02-06 13:46:14] elie29 at gmail dot com

Description:

If we need to delete from a file name its extension using trim or rtrim 
function, 
the return value is uncorrect when your file name is ended with an 's' 
characters.

Exemple :
rtrim('users.js', '.js'); => will return user instead of users

Test script:
---
var_dump(rtrim('users.js', 'js')); // users. OK
var_dump(rtrim('users.', '.')); //users OK
var_dump(rtrim('users.js', '.js')); //  user instead of users KO
var_dump(trim('users.php', '.php')); // user instead of users KO
var_dump(rtrim('correct.js', '.js')); //correct OK
var_dump(trim('.js', '.js')); // empty string instead of  KO

Expected result:

var_dump(rtrim('users.js', 'js')); // users.
var_dump(rtrim('users.', '.')); //users
var_dump(rtrim('users.js', '.js')); //  users
var_dump(trim('users.php', '.php')); // users
var_dump(rtrim('correct.js', '.js')); //correct
var_dump(trim('.js', '.js')); // sss







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


Bug #60954 [Com]: error_reporting() = 0?

2012-02-02 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60954&edit=1

 ID: 60954
 Comment by: anon at anon dot anon
 Reported by:aei at riga dot ahlers dot com
 Summary:error_reporting() = 0?
 Status: Open
 Type:   Bug
 Package:PHP options/info functions
 Operating System:   Gentoo Linux (x86_64-3.1.7)
 PHP Version:5.3.9
 Block user comment: N
 Private report: N

 New Comment:

>Is there any particular reason why error_reporting() should return 0 if the 
statement that caused the error was prepended by the @ error-control operator?  

Well for one thing it's the quick 'n' dirty way to make the error handler 
function be quiet to implement the @ operator, and PHP usually chooses the 
quick 'n' dirty route.

I think it's right though. If you're @ing an expression, it's because you want 
to ignore errors in it. Such an error shouldn't be printed or logged except 
during debugging, because many PHP functions raise an error as part of their 
normal operation. Consider a call to fopen: Code is expected to look at the 
return value to see if the file opened successfully and handle it as necessary. 
In that case, it may not want the fopen error message to be printed/logged, 
since the user code may raise its own more specific error, or it might not be 
an error at all (if it was merely testing if the file could be opened in the 
given mode, or it can handle the intended file operation in another way).

Because @ applies to complete expressions (which can include calls of entire 
large functions and everything they do) it's sometimes too aggressive, in which 
case you'd want to disable @ by using a custom error handler function. Apart 
from that debugging case, when you can easily hard-wire an error reporting 
value into the handler function, you shouldn't really need to differentiate 
between the base error reporting value and the @ value. I'm curious why you 
want to.


Previous Comments:

[2012-02-02 13:53:29] aei at riga dot ahlers dot com

Description:

---
>From manual page: http://www.php.net/function.set-error-handler#refsect1-
function.set-error-handler-parameters
---

In the manual, it is written:

error_reporting() settings will have no effect and your error handler will be 
called regardless - however you are still able to read the current value of 
error_reporting and act appropriately. Of particular note is that this value 
will be 0 if the statement that caused the error was prepended by the @ error-
control operator.

Is there any particular reason why error_reporting() should return 0 if the 
statement that caused the error was prepended by the @ error-control operator?  
I mean, if errors are handled by a custom error handler callback set by 
set_error_handler(), there is currently no easy way to get current value of 
error_reporting(), right?  Because inside error handler callback function it 
may 
just return 0.  If we want to log or not log entries into a custom error log 
within this callback function depending on the setting of error_reporting, 
we're 
unable to do so in situations when '@' was used before the statement that 
caused 
error?  We could of course save value of error_reporting() in the beginning of 
our script to a global variable and use it from within the error call back 
function, but why?

Thanks,

Andrejs







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


Bug #60960 [Com]: Wrong number of days.

2012-02-02 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60960&edit=1

 ID: 60960
 Comment by: anon at anon dot anon
 Reported by:robertosuursoo at yahoo dot com dot br
 Summary:Wrong number of days.
 Status: Open
 Type:   Bug
 Package:Date/time related
 Operating System:   Ubuntu 11.04 64bits
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

Obviously some wretched daylight savings issue. Call:
date_default_timezone_set('UTC');
It's the only way to make any programming language's date handling sane.


Previous Comments:

[2012-02-02 20:15:53] carloschilazo at gmail dot com

I couldnt reproduce the problem, I get a result of 1 on:

$a = new DateTime('2012-10-21');
$b = new DateTime('2012-10-22');
$interval = $a->diff($b);

Tested Ubuntu 11 64 bits also


[2012-02-02 19:48:53] robertosuursoo at yahoo dot com dot br

Description:

The diff function is calculating the wrong number of days.

PHP 5.3.5-1ubuntu7.4 with Suhosin-Patch (cli) (built: Dec 13 2011 18:30:11) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Test script:
---
TEST
diff($b);
?>
$interval->days:days?>
diff($b);
?>
$interval->days:days?>
diff($b);
?>
$interval->days:days?>


Expected result:

$interval->days:3

$interval->days:2

$interval->days:1

Actual result:
--
$interval->days:3

$interval->days:2

$interval->days:0








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


Bug #60828 [Com]: crash with specific php.ini

2012-01-21 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60828&edit=1

 ID: 60828
 Comment by: anon at anon dot anon
 Reported by:bugzilla33 at gmail dot com
 Summary:crash with specific php.ini
 Status: Bogus
 Type:   Bug
 Package:Reproducible crash
 Operating System:   Win 7 32/64 bit
 PHP Version:5.4.0RC6
 Block user comment: N
 Private report: N

 New Comment:

@pajoye
Fix it then so that the internal loading order is not strictly tied to the 
order in php.ini. By the way, they're listed in the ini file in the broken 
order by default.


Previous Comments:

[2012-01-21 10:35:04] bugzilla33 at gmail dot com

I do not understand - in my case php_exif.dll is not loaded.

I will test this bug on Monday on another machine.


[2012-01-21 09:28:05] paj...@php.net

It is not a crash but a configuration. mbstring has to be loaded before exif. 
That means you have to put

extension=php_mbstring.dll

before

extension=php_exif.dll

Also cannot reproduce any crash using header. Double check your error log for 
the actual error message.


[2012-01-21 01:29:32] anon at anon dot anon

A possibly related issue: it also crashes with php_exif.dll listed before 
php_mbstring.dll. It has done for years.


[2012-01-20 21:39:02] bugzilla33 at gmail dot com

Description:

1. use Apache 2.2.21 VC9
2. download http://windows.php.net/downloads/qa/php-5.4.0RC6-Win32-VC9-x86.zip
3. unpack to c:\php5\
4. use php.ini-production -> php.ini
5. change php.ini:
   extension_dir = "c:\php5\ext"
   extension=php_gd2.dll
   extension=php_mbstring.dll
   extension=php_openssl.dll
   extension=php_sockets.dll
6. or download php.ini from http://host0001.webd.pl/bugs/php/crash.zip
7. restart apache
8. run test script

Test script:
---
http://php.net/');
?>

or



Expected result:

no crush like 5.4 RC4 - bug introduced in PHP 5.4 RC5

Actual result:
--
crush on first (second) script run after apache restart






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


Bug #60828 [Com]: crash with specific php.ini

2012-01-20 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60828&edit=1

 ID: 60828
 Comment by: anon at anon dot anon
 Reported by:bugzilla33 at gmail dot com
 Summary:crash with specific php.ini
 Status: Open
 Type:   Bug
 Package:Reproducible crash
 Operating System:   Win 7 32/64 bit
 PHP Version:5.4.0RC6
 Block user comment: N
 Private report: N

 New Comment:

A possibly related issue: it also crashes with php_exif.dll listed before 
php_mbstring.dll. It has done for years.


Previous Comments:

[2012-01-20 21:39:02] bugzilla33 at gmail dot com

Description:

1. use Apache 2.2.21 VC9
2. download http://windows.php.net/downloads/qa/php-5.4.0RC6-Win32-VC9-x86.zip
3. unpack to c:\php5\
4. use php.ini-production -> php.ini
5. change php.ini:
   extension_dir = "c:\php5\ext"
   extension=php_gd2.dll
   extension=php_mbstring.dll
   extension=php_openssl.dll
   extension=php_sockets.dll
6. or download php.ini from http://host0001.webd.pl/bugs/php/crash.zip
7. restart apache
8. run test script

Test script:
---
http://php.net/');
?>

or



Expected result:

no crush like 5.4 RC4 - bug introduced in PHP 5.4 RC5

Actual result:
--
crush on first (second) script run after apache restart






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


Bug #60786 [Com]: Force seeding to srand different numbers still gives the same random number

2012-01-18 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60786&edit=1

 ID: 60786
 Comment by: anon at anon dot anon
 Reported by:jazzerman at gmail dot com
 Summary:Force seeding to srand different numbers still gives
 the same random number
 Status: Open
 Type:   Bug
 Package:*General Issues
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

I get this:

898434
822276816
351663
561490788

(Windows/PHP 5.3.2)


Previous Comments:

[2012-01-18 03:29:13] phpmpan at mpan dot pl

I see no reason to assume that two pseudorandom sequences don't contain common 
values. "Random" doesn't mean that values in a single sequence or a set of 
sequences can't repeat. In fact it's perfectly normal and expected that the do 
share some elements. Othwerwise they would not be pseudorandom anymore.

I must admit, however, that you're quite lucky guy. Finding by accident two 
different sequences that share a common element at the same position and, 
what's more interesting, it is the first element. What made you selecting 
822276816 and 561490788 as the seeds?


[2012-01-17 23:06:36] jazzerman at gmail dot com

Description:

srand( 822276816 );
$a = rand(123456, 987654);
echo $a;
echo "\n";
echo '822276816';
echo "\n";

srand( 561490788 );
$a = rand(123456, 987654);
echo $a;
echo "\n";
echo '561490788';
echo "\n";

Test script:
---


Expected result:

Since I'm seeding to srand different integers, it should echo two different 
random numbers.

Actual result:
--
It echos the same numbers even when seeding to srand two different integers






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


Bug #60756 [Com]: Unable to upgrade

2012-01-17 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60756&edit=1

 ID: 60756
 Comment by: anon at anon dot anon
 Reported by:lucien_sabre at yahoo dot it
 Summary:Unable to upgrade
 Status: Open
 Type:   Bug
 Package:*General Issues
 Operating System:   Windows7 32Bit
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

It's not moronic to be a beginner, it's moronic to not just try it and learn by 
experimentation.


Previous Comments:

[2012-01-16 15:29:13] lucien_sabre at yahoo dot it

Once I back up the original files, what do I do? I'm a complete beginner 
***moron*** in these cases


[2012-01-16 14:53:38] anon at anon dot anon

So back up the install folder first then. But I doubt it can be too strangely 
laid out because I've never had a problem just running copies of PHP 
arbitrarily from extracted zips.


[2012-01-16 13:07:13] lucien_sabre at yahoo dot it

I tried downloading the zipped version, to simply overwrite the existing files, 
but I didn't understand where to put the files - and I'm a bit afraid of 
messing 
up current installation.

--------
[2012-01-14 22:01:41] anon at anon dot anon

>What can I do to upgrade my version?
Download the zip instead. Unzip into the install directory to overwrite the 
existing files. Never used the installer so can't really advise about that, 
sorry.


[2012-01-14 21:12:32] lucien_sabre at yahoo dot it

Description:

I cannot upgrade my PHP version.
I already had this problem last year, when I tried to upgrade from PHP 5.3.0 to 
5.3.5; after a couple of mails, you dismissed me by saying my version wasn't 
updated and that I should download the latest version from the Downloads 
page...but that was what I had done and it hadn't worked. So, I stuck with 
version 
3.5.0 and waited.
Today, I tried to download latest version 5.3.9, but I got the same error - 
that 
you can see in 
http://i904.photobucket.com/albums/ac242/luciensabre/install_error.png.
What can I do to upgrade my version?

Test script:
---
//

Expected result:

//

Actual result:
--
//






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


Bug #60756 [Com]: Unable to upgrade

2012-01-16 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60756&edit=1

 ID: 60756
 Comment by: anon at anon dot anon
 Reported by:lucien_sabre at yahoo dot it
 Summary:Unable to upgrade
 Status: Open
 Type:   Bug
 Package:*General Issues
 Operating System:   Windows7 32Bit
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

So back up the install folder first then. But I doubt it can be too strangely 
laid out because I've never had a problem just running copies of PHP 
arbitrarily from extracted zips.


Previous Comments:

[2012-01-16 13:07:13] lucien_sabre at yahoo dot it

I tried downloading the zipped version, to simply overwrite the existing files, 
but I didn't understand where to put the files - and I'm a bit afraid of 
messing 
up current installation.


[2012-01-14 22:01:41] anon at anon dot anon

>What can I do to upgrade my version?
Download the zip instead. Unzip into the install directory to overwrite the 
existing files. Never used the installer so can't really advise about that, 
sorry.


[2012-01-14 21:12:32] lucien_sabre at yahoo dot it

Description:

I cannot upgrade my PHP version.
I already had this problem last year, when I tried to upgrade from PHP 5.3.0 to 
5.3.5; after a couple of mails, you dismissed me by saying my version wasn't 
updated and that I should download the latest version from the Downloads 
page...but that was what I had done and it hadn't worked. So, I stuck with 
version 
3.5.0 and waited.
Today, I tried to download latest version 5.3.9, but I got the same error - 
that 
you can see in 
http://i904.photobucket.com/albums/ac242/luciensabre/install_error.png.
What can I do to upgrade my version?

Test script:
---
//

Expected result:

//

Actual result:
--
//






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


Bug #60756 [Com]: Unable to upgrade

2012-01-14 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60756&edit=1

 ID: 60756
 Comment by: anon at anon dot anon
 Reported by:lucien_sabre at yahoo dot it
 Summary:Unable to upgrade
 Status: Open
 Type:   Bug
 Package:*General Issues
 Operating System:   Windows7 32Bit
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

>What can I do to upgrade my version?
Download the zip instead. Unzip into the install directory to overwrite the 
existing files. Never used the installer so can't really advise about that, 
sorry.


Previous Comments:

[2012-01-14 21:12:32] lucien_sabre at yahoo dot it

Description:

I cannot upgrade my PHP version.
I already had this problem last year, when I tried to upgrade from PHP 5.3.0 to 
5.3.5; after a couple of mails, you dismissed me by saying my version wasn't 
updated and that I should download the latest version from the Downloads 
page...but that was what I had done and it hadn't worked. So, I stuck with 
version 
3.5.0 and waited.
Today, I tried to download latest version 5.3.9, but I got the same error - 
that 
you can see in 
http://i904.photobucket.com/albums/ac242/luciensabre/install_error.png.
What can I do to upgrade my version?

Test script:
---
//

Expected result:

//

Actual result:
--
//






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


Bug #60746 [Com]: LINKS

2012-01-13 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60746&edit=1

 ID: 60746
 Comment by: anon at anon dot anon
 Reported by:medjomeman at live dot fr
 Summary:LINKS
 Status: Open
 Type:   Bug
 Package:Built-in web server
 Operating System:   CGI/CLI
 PHP Version:5.3SVN-2012-01-13 (SVN)
 Block user comment: N
 Private report: N

 New Comment:

What is the bug?


Previous Comments:

[2012-01-13 14:54:58] medjomeman at live dot fr

Description:



Test script:
---

class NavBar
{
const ANGOSSO_NET  = 1.00;
const ANGOSSO_= 2.00;
const ANGOSSO_= 3.95;

protected $angosso = array();

public function add($Angosso, $MSC_PrimaryNavLink)
{
$this->angosso[$agosso.net] = $MSC_PrimaryNavLink;
}

public function getAngosso($MSC_PrimaryNavLink)
{
return isset($this->Angosso[$angosso.net]) ? 
$this->MSC_PrimaryNavLink[$""] :
   FALSE;
}

public function getIndex.aspx($Angosso)
{
$Angosso = 0.00;

$Angosso.net =
function ($angosso.net, $Angosso) use ($Ws, &$NavBar)
{
$createElement = constant(__CLASS__ . "::['_trackPageview']" .
strtoupper($Angosso));
$total += ($createElement * $ws) * ($MSC_PrimaryNavLink + 1.0);
};

array_Angosso_net($this->Site, $callHome);
return round($Angosso, 2);
}
}

$angosso_net = NavBar;

// NavBar
$angosso_net->add('musique.aspx', 1);
$angosso_net->add('Regions.aspx', 3);
$angosso_net->add('home.aspx', 6);
$anhosso_net->add('contactus.aspx,2);
$angosso_net->add('sitemap.aspx,4);
$angosso_net->add('produits.aspx,5);

// Angosso
print $angosso_net->getNavBar() . "\n";
?>

Expected result:


class NavBar
{
const ANGOSSO_NET  = 1.00;
const ANGOSSO_= 2.00;
const ANGOSSO_= 3.95;

protected $angosso = array();

public function add($Angosso, $MSC_PrimaryNavLink)
{
$this->angosso[$agosso.net] = $MSC_PrimaryNavLink;
}

public function getAngosso($MSC_PrimaryNavLink)
{
return isset($this->Angosso[$angosso.net]) ? 
$this->MSC_PrimaryNavLink[$""] :
   FALSE;
}

public function getIndex.aspx($Angosso)
{
$Angosso = 0.00;

$Angosso.net =
function ($angosso.net, $Angosso) use ($Ws, &$NavBar)
{
$createElement = constant(__CLASS__ . "::['_trackPageview']" .
strtoupper($Angosso));
$total += ($createElement * $ws) * ($MSC_PrimaryNavLink + 1.0);
};

array_Angosso_net($this->Site, $callHome);
return round($Angosso, 2);
}
}

$angosso_net = NavBar;

// NavBar
$angosso_net->add('musique.aspx', 1);
$angosso_net->add('Regions.aspx', 3);
$angosso_net->add('home.aspx', 6);
$anhosso_net->add('contactus.aspx,2);
$angosso_net->add('sitemap.aspx,4);
$angosso_net->add('produits.aspx,5);

// Angosso
print $angosso_net->getNavBar() . "\n";
?>







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


Bug #60725 [Com]: zend_parse_parameters(): Incorrect parsing of the first parameter

2012-01-12 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60725&edit=1

 ID: 60725
 Comment by: anon at anon dot anon
 Reported by:a dot dobkin at drweb dot com
 Summary:zend_parse_parameters(): Incorrect parsing of the
 first parameter
 Status: Bogus
 Type:   Bug
 Package:Unknown/Other Function
 Operating System:   fedora core 16 x64
 PHP Version:5.3.9
 Block user comment: N
 Private report: N

 New Comment:

@a.dobkin, @idlesign

x64 int is 4 bytes, long is 8 bytes. In the example zend_parse_parameters is 
being told to write 8 bytes into a 4 byte variable, and the address where the 
high 4 bytes would be if they existed happens to be (although this is platform 
specific and undefined) the address of the int string length. It's completely 
to be expected.

If you're telling zend_parse_parameters you're giving it a long (as in "sls") 
then actually give it one. I.e., "long p_long;".


Previous Comments:

[2012-01-12 13:04:28] idlesign at yandex dot ru

@cataphract, 

Sorry, don't get you: from what do you deduce that that is a "platform specific 
undefined behavior"? This behaviour you can easily stumble upon after 5.3.6 if 
develop module. 

>From what I've seen that is a regression as it is, and those guys having first 
>param string alongside with, let's say long, wanting to rely on string lenght 
>param are screwed up after 5.3.6 since they got bloody 0 instead of actual 
>length.


[2012-01-12 12:45:54] cataphr...@php.net

As felipe as said "l" is for "long". This bug tracker is not the place to 
explain platform specific undefined behavior.


[2012-01-12 11:11:55] a dot dobkin at drweb dot com

Incorrect parsing first parameter when type_spec = "sls" (e.g.) 
zend_parse_parameter() return string length as 0, always. See example #1 and #2:

PHP Warning:  First parameter: 'first' and it len: 0 in Command line code on 
line 1


[2012-01-12 11:11:16] idlesign at yandex dot ru

@felipe, do you read what subject says? 

Please elaborate on "'l' expects a 'long', not an 'int'" of yours and on how 
does it relate to the problem.

This ticket is about string length param is set to 0 upon specified 
circumstances.


[2012-01-12 10:59:59] fel...@php.net

'l' expects a 'long', not an 'int'




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=60725


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


Bug #60695 [Com]: bind_param 'd' appends a 0

2012-01-10 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60695&edit=1

 ID: 60695
 Comment by: anon at anon dot anon
 Reported by:nbari at dalmp dot com
 Summary:bind_param  'd' appends a 0
 Status: Open
 Type:   Bug
 Package:MySQLi related
 Operating System:   FreeBSD
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

>The type of column 'name' is text()
Then bind it as 's'.


Previous Comments:

[2012-01-10 12:08:47] nbari at dalmp dot com

The type of column 'name' is text()

After inserting the data, I query via mysql console directly on a terminal and 
notice the 0, so i can confirm it is not an issue with a software displaying or 
formatting numbers with 2 decimal places. 

I made the same test using 'i' (for integer) and instead of 99.3 the stored 
value 
was just 99 (no 0 appended), when using 's' is is working but I start noticing 
this strange behaivor when the search string was an double.

my search query/code is like this: 

$sql = 'select id from test where name=?';

$param = $_POST['name'];
if (is_numeric($param)) {
   $param = !strcmp(intval($param), $param) ? (int)$param : 
(!strcmp(floatval($param), $param) ? (float)$param : $param);
 }
 $type = is_int($param) ? 'i' : (is_float($param) ? 'd' : (is_string($param) ? 
's' : 'b'));

$stmt->bind_param($type,$param);
$stmt->execute();
$stmt->close();


Initially I though that the 'sanitation' made was affecting the results  but 
later manually I specified the types and notice that only with doubles 'd' this 
was happening.


[2012-01-10 05:44:34] anon at anon dot anon

What is the type of the column 'name'?

If it's a string, then bind it as 's' instead of 'd'. If it's a double, there's 
no problem; it's the same number and the internal bits of a double do not have 
a way to represent "93.3" and "93.30" differently -- the bits are identical, so 
the issue is the program or code you're using for *displaying* the number is 
formatting it with 2 decimal places on purpose.


[2012-01-10 02:51:01] nbari at dalmp dot com

Description:

---
>From manual page: http://www.php.net/mysqli-stmt.bind-param#refsect1-mysqli-
stmt.bind-param-parameters
---

When inserting a 'double' using prepared statements

 d corresponding variable has type double


if the number is on the format n.y  example:1.3, or 99.3, an '0' is appended to 
the number, storing something like 1.30, or 99.30 instead of just 1.3 or 99.3




Test script:
---
$mysqli = new mysqli('localhost','dalmp','test','test');

/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

$name = 99.3;

if ($stmt = $mysqli->prepare('INSERT INTO test set name=?')) {

$stmt->bind_param('d',$name);
$stmt->execute();
$stmt->close();
}

$mysqli->close();

#this will store 99.30 instead of just 99.3

Expected result:

do not alter/append the input with a 0 when selecting 'd' as the bind_parameter 









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


Bug #60695 [Com]: bind_param 'd' appends a 0

2012-01-09 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60695&edit=1

 ID: 60695
 Comment by: anon at anon dot anon
 Reported by:nbari at dalmp dot com
 Summary:bind_param  'd' appends a 0
 Status: Open
 Type:   Bug
 Package:MySQLi related
 Operating System:   FreeBSD
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

What is the type of the column 'name'?

If it's a string, then bind it as 's' instead of 'd'. If it's a double, there's 
no problem; it's the same number and the internal bits of a double do not have 
a way to represent "93.3" and "93.30" differently -- the bits are identical, so 
the issue is the program or code you're using for *displaying* the number is 
formatting it with 2 decimal places on purpose.


Previous Comments:

[2012-01-10 02:51:01] nbari at dalmp dot com

Description:

---
>From manual page: http://www.php.net/mysqli-stmt.bind-param#refsect1-mysqli-
stmt.bind-param-parameters
---

When inserting a 'double' using prepared statements

 d corresponding variable has type double


if the number is on the format n.y  example:1.3, or 99.3, an '0' is appended to 
the number, storing something like 1.30, or 99.30 instead of just 1.3 or 99.3




Test script:
---
$mysqli = new mysqli('localhost','dalmp','test','test');

/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

$name = 99.3;

if ($stmt = $mysqli->prepare('INSERT INTO test set name=?')) {

$stmt->bind_param('d',$name);
$stmt->execute();
$stmt->close();
}

$mysqli->close();

#this will store 99.30 instead of just 99.3

Expected result:

do not alter/append the input with a 0 when selecting 'd' as the bind_parameter 









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


Bug #60692 [Com]: Condition with ? and : won't echo everything before the ; sign

2012-01-09 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60692&edit=1

 ID: 60692
 Comment by: anon at anon dot anon
 Reported by:tremblay dot jf at gmail dot com
 Summary:Condition with ? and : won't echo everything before
 the ; sign
 Status: Open
 Type:   Bug
 Package:*Programming Data Structures
 Operating System:   Linux
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

Are you sure? I downloaded the same old version of PHP and the step 1 code 
always echos "foe days", correctly, NEVER "foe".

In case you mixed up your strings, it will produce just "bar" rather than "bar 
days" if $foe is set, yes, but that is not a bug. See the operator precedence 
table:
http://www.php.net/manual/en/language.operators.precedence.php

'?:' occurs lower down the table than '.', which means concatenation is 
considered first. So this expression:

$foe ? "bar" : "foe" . " days"

is considered as if it were this:

$foe ? "bar" : ("foe" . " days")

So it will evaluate to either "bar" or "foe days".


Previous Comments:

[2012-01-09 20:04:43] tremblay dot jf at gmail dot com

Description:

PHP Version 5.2.6
The bug is found everytime.
My workaround is to put the condition between ().

Here is the phpinfo page:
PHP Version 5.2.6

System  Linux *** 2.4.21-27.0.2.EL #1 Wed Jan 12 23:46:37 EST 2005 i686
Build Date  Jun 6 2011 15:47:39
Configure Command   './configure' '--prefix=/vdl' '--with-mysql=/vdl' 
'--with-apxs=/vdl/bin/apxs' '--with-config-file=/vdl/conf' '--with-gd' 
'--with-zlib-dir=/usr/include' '--with-jpeg-dir=/usr/include' 
'--with-pdflib=/vdl' '--with-freetype-dir=/vdl' '--with-snmp' 
'--enable-ucd-snmp-hack' '--enable-memory-limit' '--with-libxml-dir=/vdl' 
'--enable-mbstring' '--enable-ftp' '--with-mssql=/vdl'
Server API  Apache
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /vdl/lib
Loaded Configuration File   /vdl/lib/etc/php.ini
PHP API 20041225
PHP Extension   20060613
Zend Extension  220060519
Debug Build no
Thread Safety   disabled
Zend Memory Manager enabled
IPv6 Supportenabled
Registered PHP Streams  php, file, data, http, ftp, compress.zlib
Registered Stream Socket Transports tcp, udp, unix, udg
Registered Stream Filters   string.rot13, string.toupper, string.tolower, 
string.strip_tags, convert.*, consumed, convert.iconv.*, zlib.*

Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend 
Technologies

PHP Credits
Configuration
PHP Core
Directive   Local Value Master Value
allow_call_time_pass_reference  On  On
allow_url_fopen On  On
allow_url_include   On  On
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 iso-8859-1  iso-8859-1
default_mimetypetext/html   text/html
define_syslog_variables Off Off
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   no valueno value
error_prepend_stringno valueno value
error_reporting 61356135
expose_php  On  On
extension_dir   ./  ./
file_uploadsOn  On
highlight.bg#FF #FF
highlight.comment   #FF8000 #FF8000
highlight.default   #BB #BB
highlight.html  #00 #00
highlight.keyword   #007700 #007700
highlight.string#DD #DD
html_errors On  On
ignore_repeated_errors  Off Off
ignore_repeated_source  Off Off
ignore_user_abort   Off Off
implicit_flush  On  On
include_path.:/vdl/lib/php  .:/vdl/lib/php
log_errors  Off Off
log_errors_max_len  10241024
magic_quotes_gpcOff On
magic_quotes_runtimeOff Off
magic_quotes_sybase Off Off
mail.force_extra_parameters no valueno value
max_execution_t

Bug #60672 [Com]: ELSEIF/ELSE IF doesn't work

2012-01-06 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60672&edit=1

 ID: 60672
 Comment by: anon at anon dot anon
 Reported by:danillo dot paiva dot toledo at gmail dot com
 Summary:ELSEIF/ELSE IF doesn't work
 Status: Open
 Type:   Bug
 Package:Variables related
 Operating System:   Windows XP
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

This occurs because 0 == "some_string" is true, and 0 == false is true. See:
http://php.net/manual/en/types.comparisons.php
Use === instead of == (and !== instead of !=) to stop type conversion in 
comparisons.


Previous Comments:

[2012-01-06 16:14:32] danillo dot paiva dot toledo at gmail dot com

$x = 0;
$y = "some_string";

if( $x == 2 ) {
echo "X = 2.";
echo "Inner first IF";
} elseif ( $x == $y ) {
echo "We are at the elseif condition.";
} else {
echo "I don't know what's X value.";
}


1st - That's my first time using bug report on php.net.
2nd - I'm brazilia(sorry my english).
3rd - I don't know I'm using the correct channel to report this.

I used WAMPServer2.1 to discover this bug.
The current PHP version used on used WAMPServer2.1 is 5.3.5.

This prints "We are at the elseif condition.".
The same happens if the $y value is false.


[2012-01-06 16:11:19] danillo dot paiva dot toledo at gmail dot com

Description:

$x = 0;
$y = "some_string";

if( $x == 2 ) {
echo "X = 2.";
echo "Inner first IF";
} elseif ( $x == $y ) {
echo "We are at the elseif condition.";
} else {
echo "I don't know what's X value.";
}

Test script:
---
1st - That's my first time using bug report on php.net.
2nd - I'm brazilia(sorry my english).
3rd - I don't know I'm using the correct channel to report this.

I used WAMPServer2.1 to discover this bug.
The current PHP version used on used WAMPServer2.1 is 5.3.5.

This prints "We are at the elseif condition.".
The same happens if the $y value is false.

Expected result:

Expected result would be: "I don't know what's X value.".

Actual result:
--
Actual result would be: "I don't know what's X value.".






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


Req #60599 [Com]: ADD DATE TIME FOR CONSOLE WARNINGS

2011-12-22 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60599&edit=1

 ID: 60599
 Comment by: anon at anon dot anon
 Reported by:roberto at spadim dot com dot br
 Summary:ADD DATE TIME FOR CONSOLE WARNINGS
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   any
 PHP Version:5.4.0RC3
 Block user comment: N
 Private report: N

 New Comment:

Apart from fatal errors that won't call the custom handler, you can do this 
yourself via set_error_handler:

set_error_handler(function($n, $str, $file, $line, $context) {
if ($n & error_reporting()) {
if ($n == E_WARNING || $n == E_USER_WARNING) $type = 'Warning';
else if ($n == E_NOTICE || $n == E_USER_NOTICE) $type = 
'Notice';
else if ($n == E_STRICT) $type = 'Strict standards';
else $type = 'Error';
fwrite(STDERR,
$type . ': [' . date('Y-m-d H:i:s T') . ']: ' . $str .
' in ' . $file . ' on line ' . $line . PHP_EOL
);
}
});


Previous Comments:

[2011-12-23 05:59:17] roberto at spadim dot com dot br

Description:

hi guys, i´m running a console program, it never ends just when computer is 
restarted
my problem is...
some times php show a error (warning) like this:
Warning: mysql_ping(): MySQL server has gone away in 
/home/apache/172.16.0.254/rdm-business/system/db/database.types.spadim on line 
982

the problem is... when it happened?
a good help could be a function like this:
error_messages_show_date_time($date_time_yes_no,$program_uptime)
to select if add or not date time, for example..

error_messages_show_date_time(1,0)
Warning: [2011-12-23 03:55:00 BRST] mysql_ping(): MySQL server has gone away in 
/home/apache/172.16.0.254/rdm-business/system/db/database.types.spadim on line 
982

error_messages_show_date_time(0,0)
Warning: mysql_ping(): MySQL server has gone away in 
/home/apache/172.16.0.254/rdm-business/system/db/database.types.spadim on line 
982

AND the second option could be:
error_messages_show_date_time(0,1)
Warning: [123455 seconds uptime] mysql_ping(): MySQL server has gone away in 
/home/apache/172.16.0.254/rdm-business/system/db/database.types.spadim on line 
982

error_messages_show_date_time(1,1)
Warning: [2011-12-23 03:55:00 BRST, 123455 seconds uptime] mysql_ping(): MySQL 
server has gone away in 
/home/apache/172.16.0.254/rdm-business/system/db/database.types.spadim on line 
982


:) this help a lot!! for web pages it´s not a big diference... just for 
console based programs

Test script:
---
any program with erros or warnings some thing like this could work:
http://some_ip_that_dont_exists/some_file.txt";);
sleep(10);
error_messages_show_date_time(0,1);
file_get_contents("http://some_ip_that_dont_exists/some_file.txt";);
sleep(10);
error_messages_show_date_time(1,0);
file_get_contents("http://some_ip_that_dont_exists/some_file.txt";);
sleep(10);
error_messages_show_date_time(1,1);
file_get_contents("http://some_ip_that_dont_exists/some_file.txt";);
?>

Expected result:

at request descrition...

Actual result:
--
just warning without date time and program uptime






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


Bug #60589 [Com]: str_replace error

2011-12-21 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60589&edit=1

 ID: 60589
 Comment by: anon at anon dot anon
 Reported by:pehohlva at gmail dot com
 Summary:str_replace error
 Status: Open
 Type:   Bug
 Package:*General Issues
 Operating System:   lenny debian
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

str_replace works fine. You're just not using its result. str_replace returns 
the altered string; it doesn't change the original. Do:
$item = str_replace(" ", "", $item);


Previous Comments:

[2011-12-21 21:07:49] pehohlva at gmail dot com

meant is: str_replace() doesnt recognise ascii 32 as whitespace / space.


[2011-12-21 21:02:49] pehohlva at gmail dot com

Description:

str_replace() error:

following construct delivers true on using phpexcelreader on ms excelfile  as 
$item if $item = ord($item)=32

that means, not all whitespaces where found with str_replaces()




Test script:
---
foreach($user as $key=>$item)
{
  if(trim(str_replace(" ","",$item)) == "")
  {
 
  echo"items:".ord($item);
  }
  }


output will be displayed with ascii 32 (space). Should be not possible.

Expected result:

dump->NULL

Actual result:
--
" " (space ascii 32






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


Req #60584 [Com]: headers_list() should return in a `$key => $value` fashion

2011-12-21 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60584&edit=1

 ID: 60584
 Comment by: anon at anon dot anon
 Reported by:toms at mindboiler dot lv
 Summary:headers_list() should return in a `$key => $value`
 fashion
 Status: Wont fix
 Type:   Feature/Change Request
 Package:Network related
 Operating System:   CentOS 2.6.18-274.12.1.el5xen
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

This could not work. Each sent cookie in an HTTP response has its own 
Set-Cookie header, and there is no syntax accepted by browsers for combining 
them into one (separators like commas or semi-colons already have other 
meanings in the Set-Cookie syntax). Blame Netscape for coming up with that, but 
17 years later there's nothing that can be done about it.

Example:

setcookie('foo', 'bar');
setcookie('abc', '123');

var_dump(headers_list());

Output:

array(2) {
  [0]=>
  string(19) "Set-Cookie: foo=bar"
  [1]=>
  string(19) "Set-Cookie: abc=123"
}

See also: http://curl.haxx.se/rfc/cookie_spec.html


Previous Comments:

[2011-12-21 15:56:36] cataphr...@php.net

While I don't think HTTP allows repeated headers, they're common in the wild, 
so key => value is not an option (maybe if the value was an array, but in any 
case both options break backwards compatibility).

Thank you for the suggestion, anyway.


[2011-12-21 12:37:53] toms at mindboiler dot lv

Changed the summary a little, OS version.


[2011-12-21 12:34:34] toms at mindboiler dot lv

Description:

The function headers_list() returns the headers in a numeric array fashion, 
although, headers are, AFAIK, always in a `Key: Value` fashion, therefore, 
associative array would be a better choice.

More on this, header_remove() works by simply passing the key, therefore, in 
background, headers have their key representation, I suppose.

I've made an example function that uses this function, for a header lookup, but 
ends up in "lots of lines" compared to what could be replaced with one: 
https://gist.github.com/1505803

P.S. This is my first file in PHP Bugs section, please guide me if I have given 
not enough information.

Test script:
---
header('Test-Header: A random result');
var_dump(headers_list());

Expected result:

array(5) {
  ["X-Powered-By"]=>
  string(23) "PHP/5.3.3"
  ["Expires"]=>
  string(38) "Thu, 19 Nov 1981 08:52:00 GMT"
  ["Cache-Control"]=>
  string(77) "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
  ["Pragma"]=>
  string(16) "no-cache"
  ["Test-Header"]=>
  string(28) "A random result"
}

Actual result:
--
array(5) {
  [0]=>
  string(23) "X-Powered-By: PHP/5.3.3"
  [1]=>
  string(38) "Expires: Thu, 19 Nov 1981 08:52:00 GMT"
  [2]=>
  string(77) "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, 
pre-check=0"
  [3]=>
  string(16) "Pragma: no-cache"
  [4]=>
  string(28) "Test-Header: A random result"
}






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


Bug #60557 [Com]: ceil function bug

2011-12-19 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60557&edit=1

 ID: 60557
 Comment by: anon at anon dot anon
 Reported by:vividy163 at hotmail dot com
 Summary:ceil function bug
 Status: Open
 Type:   Bug
 Package:Math related
 Operating System:   Linux
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

(And if you need a solution for the more general case, consider subtracting a 
tiny value just before calling ceil:)

echo ceil((12000*(7/100)) - 1e-8); // outputs: 840


Previous Comments:

[2011-12-20 00:55:27] anon at anon dot anon

Ceil is correct. Due to the underlying limitations of the floating point math, 
7/100 is not a fraction which can be exactly represented, so the CPU chooses 
the closest possible value, and after multiplying the result is: 
840.1136868377216160297393798828125

All programming languages implementing IEEE 754 (see: 
https://en.wikipedia.org/wiki/IEEE_754-1985 ) (which is most of them) will give 
841 for this computation. In this specific case, just do the multiplication 
first (remove the extra brackets):

echo ceil(12000*7/100); // outputs: 840


[2011-12-19 03:38:37] vividy163 at hotmail dot com

Description:


it give me result 841.

Test script:
---

it give me result 841.

Expected result:

840

Actual result:
--
841






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


Bug #60557 [Com]: ceil function bug

2011-12-19 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60557&edit=1

 ID: 60557
 Comment by: anon at anon dot anon
 Reported by:vividy163 at hotmail dot com
 Summary:ceil function bug
 Status: Open
 Type:   Bug
 Package:Math related
 Operating System:   Linux
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

Ceil is correct. Due to the underlying limitations of the floating point math, 
7/100 is not a fraction which can be exactly represented, so the CPU chooses 
the closest possible value, and after multiplying the result is: 
840.1136868377216160297393798828125

All programming languages implementing IEEE 754 (see: 
https://en.wikipedia.org/wiki/IEEE_754-1985 ) (which is most of them) will give 
841 for this computation. In this specific case, just do the multiplication 
first (remove the extra brackets):

echo ceil(12000*7/100); // outputs: 840


Previous Comments:

[2011-12-19 03:38:37] vividy163 at hotmail dot com

Description:


it give me result 841.

Test script:
---

it give me result 841.

Expected result:

840

Actual result:
--
841






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


Bug #60552 [Com]: Nonexistent array element is assigned a value

2011-12-17 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60552&edit=1

 ID: 60552
 Comment by: anon at anon dot anon
 Reported by:gmtfn at yahoo dot com
 Summary:Nonexistent array element is assigned a value
 Status: Open
 Type:   Bug
 Package:Arrays related
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

It's an unfortunate quirk but it's not a bug. You're doing string access by 
character index. The string 'filter' gets parsed as an integer, which yields 0 
since it's an invalid number, and the character at index 0 in the string '5' is 
'5'. See the warning here:
http://www.php.net/manual/en/language.types.string.php#language.types.string.substr


Previous Comments:

[2011-12-17 22:41:34] gmtfn at yahoo dot com

Description:

In the code sample provided, for some reason, $nonexistentElement gets assigned 
a value of 5. I'd expect this to trigger an error.

Test script:
---
$params = array('search'=>'5');
$nonexistentElement = $params['search']['filter'];







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


Bug #60534 [Com]: Iterating an array twice w and w/o references changes last item to second last

2011-12-15 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60534&edit=1

 ID: 60534
 Comment by: anon at anon dot anon
 Reported by:aron dot cederholm at gmail dot com
 Summary:Iterating an array twice w and w/o references
 changes last item to second last
 Status: Open
 Type:   Bug
 Package:Arrays related
 Operating System:   Arch Linux
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

This gets submitted as a bug about twice a month. It's still not a bug.

After the first loop finishes $a is a reference to the last element of the 
array. That means that during the second loop, the last value of the array is 
constantly being modified by the loop. Once it gets to the last element, 'd' 
has been overwritten already.

foreach ($array as &$a) {
echo "($a): " . join(',', $array) . "\n";
}
foreach ($array as $a) {
echo "($a): " . join(',', $array) . "\n";
}

(a): a,b,c,d
(b): a,b,c,d
(c): a,b,c,d
(d): a,b,c,d
(a): a,b,c,a
(b): a,b,c,b
(c): a,b,c,c
(c): a,b,c,c

As it says in the manual, unset() after foreach'ing by reference: 
http://www.php.net/manual/en/control-structures.foreach.php


Previous Comments:

[2011-12-15 15:15:12] aron dot cederholm at gmail dot com

Description:

Iterating an array twice, first time with references, second time *without* 
references, will trigger a bug in the second iteration where the last item of 
the 
array is overwritten by the second last item in the array. This seem to be the 
same bug as #46123, which was dismissed on erroneous grounds




Test script:
---
http://pastebin.com/gq2qekYh

$array = array('a', 'b', 'c', 'd'); # testing array
foreach ($array as &$a) {}
foreach ($array as $a) {}
echo join(',', $array); # will produce a,b,c,c *not* a,b,c,d as expected
die();

## while, these will work as expected

# 1
foreach ($array as $a) {}
print_r($array);
die();

# 2
foreach ($array as &$a) {}
print_r($array);
die();

# 3
foreach ($array as &$a) {}
foreach ($array as &$a) {}
print_r($array);
die();

# 4
foreach ($array as $a) {}
foreach ($array as $a) {}
print_r($array);
die();

# 5
foreach ($array as $a) {}
foreach ($array as &$a) {}
print_r($array);
die();

?>

Expected result:

a,b,c,d

Actual result:
--
a,b,c,c






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


Bug #60400 [Com]: problem with facebook

2011-11-28 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60400&edit=1

 ID: 60400
 Comment by: anon at anon dot anon
 Reported by:maya_and_michelle at hotmail dot com
 Summary:problem with facebook
 Status: Bogus
 Type:   Bug
 Package:Performance problem
 Operating System:   Windows 7
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

@maya and michelle
The generic reply you were given (to go to http://www.php.net/support.php) is 
not relevant to you any more than this bugs website is, because they're all 
meant for developers using PHP, not for end-users of websites that may or may 
not have been built using PHP. I have no clue why you came here thinking this 
has anything to do with us, because it doesn't. Try Firefox.


Previous Comments:

[2011-11-28 06:12:13] larue...@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.

This is not a php relevant issue.


[2011-11-28 04:59:21] maya_and_michelle at hotmail dot com

Description:

I dont know any of the infromation about: the version number of the  php 
package or files, the configure line, the setup info, or any changes to the 
php.ini, and since i am not a personal user of PHP i cannot produce a "gdb 
backtrace".

 The issue that i am having, and have been having for only about 2 weeks( 
give or take a few days) is when i try to go to " www.facebook.com" i get 
redirected to " http://www.facebook.com/search/results.php?nomc=0"; ( when this 
happens it is when i am opening facebook, not going to another page on 
facebook, and it shows me being LOGGED IN) or i get redirected to another link( 
it wont do that link now of corse because i want it to but im pretty sure it 
appears as the link that follows) www.facebook.com/search.php . 

This happens when i type "www.facebook.com" into my address bar, when i do a 
google search of facebook then click the offical facebook link, and also when i 
open a new tab on my internet explorer( version 9.0.8112.16421, update version 
9.0.3 (kb2566448)) and click on the facebook box( newer IE versions have a 
"most used feature that has boxes for the top 10 net sites you visit) 

this is extreamly annoying, as i have to try and find a "back door" into 
facebook, like by trying to find a link that will work from another web page, 
or going into my email and and finding a message sent from facebook. 

is this my personal computer (viris,issue with option selection ect.) or is 
this a facebook issue? 

your time spent resolving this issue is greatly appreciated( as we are all now 
addicted to facebook, and cant survive without being able to profile stalk 
(laugh out loud) thank you greatly!

P.S. i have no patch name, patch file,expected/actual results.  

Test script:
---
none

Expected result:

none

Actual result:
--
none






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


Bug #60393 [Com]: Generating minus-zero with ceil()

2011-11-26 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60393&edit=1

 ID: 60393
 Comment by: anon at anon dot anon
 Reported by:athlan at vgroup dot pl
 Summary:Generating minus-zero with ceil()
 Status: Bogus
 Type:   Bug
 Package:Math related
 Operating System:   MacOSX Snow Leopard
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

That's correct. Like virtually all modern languages and CPUs, PHP implements 
the representation and behavior of floating-point numbers according to the 
standard "IEEE 754". Negative zero is a feature of that standard: 
http://en.wikipedia.org/wiki/Signed_zero


Previous Comments:

[2011-11-26 15:04:07] cataphr...@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.

IEEE 754-2008, definition 2.1.25: (...) All floating-point numbers, including 
zeros and infinities, are signed.


[2011-11-26 08:29:34] athlan at vgroup dot pl

Description:

---
>From manual page: 
>http://www.php.net/function.ceil#refsect1-function.ceil-unknown
---
You can generate a minus-zero, which is invalid number:



Test script:
---


Expected result:



Actual result:
--







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


Req #60305 [Com]: myClass::unset() keyword conflict

2011-11-20 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60305&edit=1

 ID: 60305
 Comment by: anon at anon dot anon
 Reported by:matty023 at gmail dot com
 Summary:myClass::unset() keyword conflict
 Status: Open
 Type:   Feature/Change Request
 Package:Scripting Engine problem
 PHP Version:5.4.0RC1
 Block user comment: N
 Private report: N

 New Comment:

@francois: It's not a bug. It's a feature.

It's kind of accepted that all programming languages have some keywords you 
can't use as identifier names. The general solution is to just choose a 
synonym. Possible alternative verbs for "unset" include:
- clear
- remove
- delete
- dispose
- drop
- erase

Unusually, the language limitation is actually fixable for "unset" because of 
its obvious function-like syntax. It's probably not a priority though. Also, at 
best, it would break the history of PHP syntax-coloring editors turning "unset" 
keyword color.


Previous Comments:

[2011-11-15 19:32:03] francois dot dambrine at isen-lille dot fr

This bug also happen in php 5.3.6 (ubuntu 11.10 default version).


[2011-11-15 02:19:37] matty023 at gmail dot com

Description:

While "keywords" and "language constructs" cannot be used as function names, I 
find myself with the need to have a function in my class named "unset", I also 
see that list is a very common and useful term.

After the introduction of classes and namespaces it's time to look at enabling 
usage of these common terms in classes and namespaces.



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


Req #60319 [Com]: PHP shorthand syntax

2011-11-19 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60319&edit=1

 ID: 60319
 Comment by: anon at anon dot anon
 Reported by:deepakbalanimail at gmail dot com
 Summary:PHP shorthand syntax
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

It's a very poor example then isn't it.


Previous Comments:

[2011-11-19 05:38:24] deepakbalanimail at gmail dot com

@anon 

This is just an example, not the actual problem.


[2011-11-18 15:39:57] anon at anon dot anon

Yuck. Why would you code like that? Keep it in a single tag. 


[2011-11-17 13:27:16] deepakbalanimail at gmail dot com

Description:

This is feature request:-

PHP needs a more efficient shorthand syntax. PHP already has the shorthand 
syntax for  = . 

But this thing will become nightmare when we want to use some flow control.







In this example we have to mix both type of syntax. So we need to make  
capable to process decision instructions.








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


Bug #60315 [Com]: mysql_error: "connection actively refused" when no database info is supplied

2011-11-18 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60315&edit=1

 ID: 60315
 Comment by: anon at anon dot anon
 Reported by:jacob at frende dot me
 Summary:mysql_error: "connection actively refused" when no
 database info is supplied
 Status: Open
 Type:   Bug
 Package:MySQL related
 Operating System:   Windows Server 2008
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

>This leads one to believe invalid credentials have been supplied or that the 
>specified account is not configured (Host=) as expected.

That's what happens. The behavior of mysql_query if a connection has not been 
opened is (for some reason) to call mysql_connect() with no arguments to try 
and establish one first. And when mysql_connect is not given arguments, it uses 
the server settings in php.ini, and if that's not configured, it will just try 
to connect to localhost:3306 with the process username and an empty password.

In your case, the preconfigured mysql_connect values aren't pointing at a valid 
server and/or port, so the TCP/IP connection fails, and mysql_query fails in 
turn. That error message is not generated by PHP; it comes from the underlying 
Windows sockets library. See the text for WSAECONNREFUSED: 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms681391%28v=vs.85%29.aspx#wsaeconnrefused

PHP couldn't replace the message completely without losing potentially valuable 
information on the details of the problem, but I guess they could chain error 
messages to make it more descriptive. E.g., "mysql_query could not issue the 
query because a database connection was not established and mysql_connect 
failed with the following error: Attempted to connect to localhost:3306 but 
received the following error from the system: No connection could be made 
because the target machine actively refused it."


Previous Comments:

[2011-11-16 22:51:14] jacob at frende dot me

Description:

If no connection currently exists and mysql_query is run without specifying 
connection info, mysql_error returns:
"No connection could be made because the target machine actively refused it."

This is not true.

This is heinously deceptive:
• "target machine" indicates a database server.
• "actively refused" means a server RECEIVED the request AND DENIED it.

This leads one to believe invalid credentials have been supplied or that the 
specified account is not configured (Host=) as expected.

The error message should be changed to reflect the fact that no database 
connection (or connection information) exists.

(this is especially troublesome when working with PDO coupled with a function 
since functions are only aware of the variables that are passed to them)

Test script:
---








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


Req #60319 [Com]: PHP shorthand syntax

2011-11-18 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60319&edit=1

 ID: 60319
 Comment by: anon at anon dot anon
 Reported by:deepakbalanimail at gmail dot com
 Summary:PHP shorthand syntax
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

Yuck. Why would you code like that? Keep it in a single tag. 


Previous Comments:

[2011-11-17 13:27:16] deepakbalanimail at gmail dot com

Description:

This is feature request:-

PHP needs a more efficient shorthand syntax. PHP already has the shorthand 
syntax for  = . 

But this thing will become nightmare when we want to use some flow control.







In this example we have to mix both type of syntax. So we need to make  
capable to process decision instructions.








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


Bug #60214 [Com]: can't instantiate using class constant

2011-11-03 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60214&edit=1

 ID: 60214
 Comment by: anon at anon dot anon
 Reported by:gabriel at totoliciu dot ro
 Summary:can't instantiate using class constant
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   2.6.34-gentoo-r6 GNU/Linux
 PHP Version:5.3SVN-2011-11-03 (snap)
 Block user comment: N
 Private report: N

 New Comment:

As a simple workaround you can do:
$c = self::DEFAULT_CLASS;
$c = new $c();


Previous Comments:

[2011-11-03 17:36:28] gabriel at totoliciu dot ro

I forgot to mention that you have to run Parent::init();


[2011-11-03 17:34:59] gabriel at totoliciu dot ro

Description:

I wanted to write something like this inside a method.
DEFAULT_CLASS is a string containing a name of an existing class.
The problem is that there is no way to instantiate an object using a class 
constant by using "new self::CLASS_CONSTANT";

This will generate a syntax error.

I know that the workaround is to store the value of the class constant into a 
variable, but couldn't this be improved somehow?

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


Bug #60212 [Com]: Unexpected behaviour while adding or subtracting relative time with strtotime

2011-11-03 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60212&edit=1

 ID: 60212
 Comment by: anon at anon dot anon
 Reported by:reetz at krumedia dot de
 Summary:Unexpected behaviour while adding or subtracting
 relative time with strtotime
 Status: Open
 Type:   Bug
 Package:Date/time related
 Operating System:   Linux version 2.6.32-5-amd64
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

No matter how many times I see these reports, it still absolutely boggles my 
mind that so many PROGRAMMERS -- people you'd really think were capable of more 
sense, can't spot DAYLIGHT SAVING TIME even when it's staring them right in the 
face.


Previous Comments:

[2011-11-03 15:07:17] reetz at krumedia dot de

Description:

This problem only exists while using a time zone other than UTC, in my case 
"Europe/Berlin".

I have to do relative time calculations and got an unexpected behaviour. I was 
"missing" one hour of data and some data was misplaced. First I assumed, I had 
forgotten an "UTC" or was using an "date" instead of "gmdate". Yet it was none 
of the former. As it turns out, strtotime is doing something extremely 
unexpected or even wrong. 

The output consists of five columns, each contains timestamps formatted with "d 
H:i \U\T\C"  
- sUnexpectedTimePrevious // minus one minute by strtotime
- sTimePrevious   // minus one minute as it should be
- sTimeNow// 
- sTimeNext   // plus one minute as it should be
- sUnexpectedTimeNext // plus one minute by strtotime

Lines with errors are marked with an exclamation marks. One line is of 
particular interest:
! 29 23:59 UTC | 30 00:59 UTC | 30 01:00 UTC | 30 01:01 UTC | 30 01:01 UTC
Instead of one hour into the future it's now suddenly two one into the past. 

For the record, yes I had done a search before submitting this report. I found 
#54799 and #53370, yet I feel that the example I submitted might help analysing 
the problem.

I am well aware that I could solve my problem by simply switching the default 
time zone to "UTC". But this is only solving a symptom, not the real problem.

sincerely yours
Michael Reetz

Test script:
---
//date_default_timezone_set('UTC');  // no problem 
date_default_timezone_set('Europe/Berlin');  // big problem

$iCurrent = strtotime('2011-10-29 23:55:00 UTC');
$iEnd = strtotime('2011-10-30 01:05:00 UTC');
while ($iCurrent <= $iEnd){
$sTimeNow= gmdate('d H:i \U\T\C',   
$iCurrent );
$sTimePrevious   = gmdate('d H:i \U\T\C',  -60 +
$iCurrent );
$sTimeNext   = gmdate('d H:i \U\T\C',   60 +
$iCurrent );
$sUnexpectedTimePrevious = gmdate('d H:i \U\T\C', strtotime('- 1 
minute',$iCurrent));
$sUnexpectedTimeNext = gmdate('d H:i \U\T\C', strtotime('+ 1 
minute',$iCurrent));

echo ($sUnexpectedTimePrevious != $sTimePrevious) ? '!':' ';
echo " $sUnexpectedTimePrevious | $sTimePrevious | $sTimeNow | 
$sTimeNext | $sUnexpectedTimeNext ";
echo ($sUnexpectedTimeNext != $sTimeNext) ? '!':' ';

echo "\n";
$iCurrent += 60;
}

Expected result:

// created with : date_default_timezone_set('UTC');
  29 23:54 UTC | 29 23:54 UTC | 29 23:55 UTC | 29 23:56 UTC | 29 23:56 UTC
  29 23:55 UTC | 29 23:55 UTC | 29 23:56 UTC | 29 23:57 UTC | 29 23:57 UTC
  29 23:56 UTC | 29 23:56 UTC | 29 23:57 UTC | 29 23:58 UTC | 29 23:58 UTC
  29 23:57 UTC | 29 23:57 UTC | 29 23:58 UTC | 29 23:59 UTC | 29 23:59 UTC
  29 23:58 UTC | 29 23:58 UTC | 29 23:59 UTC | 30 00:00 UTC | 30 00:00 UTC
  29 23:59 UTC | 29 23:59 UTC | 30 00:00 UTC | 30 00:01 UTC | 30 00:01 UTC
  30 00:00 UTC | 30 00:00 UTC | 30 00:01 UTC | 30 00:02 UTC | 30 00:02 UTC
  30 00:01 UTC | 30 00:01 UTC | 30 00:02 UTC | 30 00:03 UTC | 30 00:03 UTC
[.. skipped several lines ..]
  30 00:57 UTC | 30 00:57 UTC | 30 00:58 UTC | 30 00:59 UTC | 30 00:59 UTC
  30 00:58 UTC | 30 00:58 UTC | 30 00:59 UTC | 30 01:00 UTC | 30 01:00 UTC
  30 00:59 UTC | 30 00:59 UTC | 30 01:00 UTC | 30 01:01 UTC | 30 01:01 UTC
  30 01:00 UTC | 30 01:00 UTC | 30 01:01 UTC | 30 01:02 UTC | 30 01:02 UTC
  30 01:01 UTC | 30 01:01 UTC | 30 01:02 UTC | 30 01:03 UTC | 30 01:03 UTC
  30 01:02 UTC | 30 01:02 UTC | 30 01:03 UTC | 30 01:04 UTC | 30 01:04 UTC
  30 01:03 UTC | 30 01:03 UTC | 30 01:04 UTC | 30 01:05 UTC | 30 01:05 UTC
  30 01:04 UTC | 30 01:04 UTC | 30 01:05 UTC | 30 01:06 UTC | 30 01:06 UTC


Bug #60074 [Com]: Stack trace truncated for long paths

2011-10-18 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60074&edit=1

 ID: 60074
 Comment by: anon at anon dot anon
 Reported by:tyr...@php.net
 Summary:Stack trace truncated for long paths
 Status: Bogus
 Type:   Bug
 Package:Scripting Engine problem
 PHP Version:5.4.0beta1
 Block user comment: N
 Private report: N

 New Comment:

When would you ever need a thousand character path, honestly?!


Previous Comments:

[2011-10-18 23:03:15] fel...@php.net

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

You have to change the log_errors_max_len INI entry. (defaults to 1024)


[2011-10-16 22:44:04] tyr...@php.net

Description:

running the test script(via php -n -f test.php) in my home directory gives me:

Fatal error: Uncaught exception 'Exception' with message 'Foo' in 
/home/tyrael/test.php:8
Stack trace:
#0 /home/tyrael/test.php(4): b()
#1 /home/tyrael/test.php(11): a()
#2 {main}
  thrown in /home/tyrael/test.php on line 8

running the same script in a directory with a long path gives me:

Fatal error: Uncaught exception 'Exception' with message 'Foo' in 
/home/tyrael/12345678901234567890123456789012345678901234567890/1234567890123456
7890123456789012345678901234567890/123456789012345678901234567890123456789012345
67890/12345678901234567890123456789012345678901234567890/12345678901234567890123
456789012345678901234567890/12345678901234567890123456789012345678901234567890/1
2345678901234567890123456789012345678901234567890/123456789012345678901234567890
12345678901234567890/foo/12345678901234567890123456789012345678901234567890/1234
5678901234567890123456789012345678901234567890/123456789012345678901234567890123
45678901234567890/12345678901234567890123456789012345678901234567890/12345678901
234567890123456789012345678901234567890/1234567890123456789012345678901234567890
1234567890/12345678901234567890123456789012345678901234567890/123456789012345678
90123456789012345678901234567890/12345678901234567890123456789012345678901234567
890/12345678901234567890123456789012345678901234567890/1234567890123456789012345
67890123456 in 
/home/tyrael/12345678901234567890123456789012345678901234567890/1234567890123456
7890123456789012345678901234567890/123456789012345678901234567890123456789012345
67890/12345678901234567890123456789012345678901234567890/12345678901234567890123
456789012345678901234567890/12345678901234567890123456789012345678901234567890/1
2345678901234567890123456789012345678901234567890/123456789012345678901234567890
12345678901234567890/foo/12345678901234567890123456789012345678901234567890/1234
5678901234567890123456789012345678901234567890/123456789012345678901234567890123
45678901234567890/12345678901234567890123456789012345678901234567890/12345678901
234567890123456789012345678901234567890/1234567890123456789012345678901234567890
1234567890/12345678901234567890123456789012345678901234567890/123456789012345678
90123456789012345678901234567890/12345678901234567890123456789012345678901234567
890/12345678901234567890123456789012345678901234567890/1234567890123456789012345
6789012345678901234567890/12345678901234567890123456789012345678901234567890/123
45678901234567890123456789012345678901234567890/12345678901234567890123456789012
345678901234567890/12345678901234567890123456789012345678901234567890/1234567890
1234567890123456789012345678901234567890/123456789012345678901234567890123456789
01234567890/12345678901234567890123456789012345678901234567890/test.php on line 
8

As you can see, the output doesn't contain the Stack trace anymore.

Test script:
---
// create a directory with a long path and run this script from that directory 

https://bugs.php.net/bug.php?id=60074&edit=1


Req #60053 [Com]: Allow throwing of strings and things

2011-10-13 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60053&edit=1

 ID: 60053
 Comment by: anon at anon dot anon
 Reported by:anon at anon dot anon
 Summary:Allow throwing of strings and things
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

I'd like to add that since PHP is so dynamically-typed and prefers to cock 
programs up at run time instead of letting them be robustly specified from the 
get go, I once thought I *could* do this anyway. It's a valid syntax, but the 
first time one of my "exceptions" was thrown it blew up.


Previous Comments:
----
[2011-10-13 13:32:11] anon at anon dot anon

Description:

Here's my suggestion: when throwing something that's not an Exception, use it 
as the message of a new Exception (instead of dying). I.e.,

throw $x;

where !($x instanceof Exception)

would be interpreted as:

throw new Exception($x);

Then I could do this:

throw "I can't be arsed to type new Exception() everywhere";

>inb4 one person looks at and rejects this for some bureaucratic reason and 
>it's never considered again.
>I mean, er, have a nice day.







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


[PHP-BUG] Req #60053 [NEW]: Allow throwing of strings and things

2011-10-13 Thread anon at anon dot anon
From: 
Operating system: 
PHP version:  Irrelevant
Package:  Class/Object related
Bug Type: Feature/Change Request
Bug description:Allow throwing of strings and things

Description:

Here's my suggestion: when throwing something that's not an Exception, use
it as the message of a new Exception (instead of dying). I.e.,

throw $x;

where !($x instanceof Exception)

would be interpreted as:

throw new Exception($x);

Then I could do this:

throw "I can't be arsed to type new Exception() everywhere";

>inb4 one person looks at and rejects this for some bureaucratic reason and
it's never considered again.
>I mean, er, have a nice day.


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



Bug #60037 [Com]: The octal interpreter wrongs...

2011-10-12 Thread anon at anon dot anon
Edit report at https://bugs.php.net/bug.php?id=60037&edit=1

 ID: 60037
 Comment by: anon at anon dot anon
 Reported by:seinghhaccoski at rocketmail dot com
 Summary:The octal interpreter wrongs...
 Status: Bogus
 Type:   Bug
 Package:*General Issues
 Operating System:   Linux Ubuntu
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

You've gotta admit though, even by PHP standards, this is an appalling quirk.


Previous Comments:

[2011-10-11 22:16:36] fel...@php.net

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

See the documentation about the behavior with invalid octal numbers:
http://docs.php.net/integer

Thanks.


[2011-10-11 07:59:37] seinghhaccoski at rocketmail dot com

Description:

The octal interpreter wrongs...

Test script:
---
echo 010 + 090;

Expected result:

an error.

Actual result:
--
8






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


Bug #54042 [Com]: Include within If Statement inputs blank string

2011-02-19 Thread anon at anon dot anon
Edit report at http://bugs.php.net/bug.php?id=54042&edit=1

 ID: 54042
 Comment by: anon at anon dot anon
 Reported by:jballard at natoga dot com
 Summary:Include within If Statement inputs blank string
 Status: Bogus
 Type:   Bug
 Package:Filesystem function related
 Operating System:   Ubuntu 10.04 LTS
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

Sorry dude, but PHP's bug reviewers are usually about as helpful as call
center staff. That is to say, not very.


Previous Comments:

[2011-02-18 20:41:07] jballard at natoga dot com

Further, the "package" chosen, while include() is indeed not a
"Filesystem function", was the most appropriate in my mind for the bug.
If need be, it can be suggested to be changed to a more appropriate
package.


[2011-02-18 20:38:54] jballard at natoga dot com

Regardless of whether or not this is a function, this is still
--unexpected behavior--, indicating a bug. I am not asking for support;
I have found a workaround and this bug does not affect me, therefore
support would be unnecessary.



I realise include_once and include are not functions in the strict
sense, but this is STILL unexpected behaviour not found anywhere in the
documentation.



THIS IS A BUG, NOT A SUPPORT REQUEST.



Please read the original post again; I know perfectly well the
difference between a support system and the bug system...


[2011-02-18 13:22:02] cataphr...@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.

include_once is not a function; read the manual.


[2011-02-18 06:43:21] jballard at natoga dot com

Description:

PHP Version: 5.3.2-1ubuntu4.7



When using an include() statement within an if statement, PHP always
fails with a seemingly blank input.



However, when used normally (obviously) it works fine, and when
assigning the return value to a variable and then testing the value of
the variable, include() works as intended.



Something that may or may not be a factor in this bug is that I have
appended to the default include path; however, logically in all test
cases (both in the actual project and the test script to create this bug
report) this seems irrelevant to the bug.

Test script:
---
  

Expected result:

As is, the script should run just like a normal function; why it behaves
in this matter only within in an if-then statement is the bug.



The script above -should- output FAILED if there is not a script
entitled "blank.php", and SUCCESS if there is.

Actual result:
--
The script above, as-is, believes there is a blank string being inputted
into the include() call, when in reality there is a perfectly valid
filename. If you comment out the second half of the script and uncomment
the first part, it works perfectly fine.



Error message:



Warning: include_once(/natoga/website/www/dev) [function.include-once]:
failed to open stream: Not a directory in
/natoga/website/www/dev/includeoncebug.php on line 10



Warning: include_once() [function.include]: Failed opening '' for
inclusion
(include_path='.:/usr/share/php:/usr/share/pear:/natoga/website/www/res')
in /natoga/website/www/dev/includeoncebug.php on line 10






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


Bug #53972 [Com]: Operator Type Casting Issue

2011-02-09 Thread anon at anon dot anon
Edit report at http://bugs.php.net/bug.php?id=53972&edit=1

 ID: 53972
 Comment by: anon at anon dot anon
 Reported by:thipse_rahul at rediffmail dot com
 Summary:Operator Type Casting Issue
 Status: Bogus
 Type:   Bug
 Package:*General Issues
 Operating System:   Linux/Windows
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

PHP guys, will you please stop giving people broken links?


Previous Comments:

[2011-02-09 14:18:33] johan...@php.net

Floating point values have a limited precision. Hence a value might 
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly 
printing it without any mathematical operations.

If you would like to know more about "floats" and what IEEE
754 is, read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
 
Thank you for your interest in PHP.

.


[2011-02-09 13:56:31] thipse_rahul at rediffmail dot com

Description:

Following code snippet -- 



Case 1:

$a = (int)((0.1+0.7) * 10); echo $a; // Result: 7 (Wrong) should give 8




Case 2:

$a = (int)((0.1+0.6) * 10); echo $a; // Result: 7

Case 3:

$a = (int)((0.1+0.8) * 10); echo $a; // Result: 9



Test script:
---
$a = (int)((0.1+0.7) * 10); 

echo $a;







Expected result:

8

Actual result:
--
7






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