#36451 [Bgs->Opn]: Array doesn't pop when array is created inside array_pop

2006-02-19 Thread epoc_32 at yahoo dot co dot ukXXX
 ID:   36451
 User updated by:  epoc_32 at yahoo dot co dot ukXXX
 Reported By:  epoc_32 at yahoo dot co dot ukXXX
-Status:   Bogus
+Status:   Open
 Bug Type: Scripting Engine problem
 Operating System: Windows XP
 PHP Version:  5.1.2
 New Comment:

This isn't a support question, I'm not asking for help in a script.
It's a minor bug in the way the script is parsed when nesting
functions.

The code in which I discovered the bug used explode() inside
array_pop(), I only used my example code to simplyfy things.

array_pop() is returning the last element of the array but isn't
truncating the array inside it. As I say, things work as expected in
PHP4 so why would PHP5 return the last element of the array without
truncating it?


Previous Comments:


[2006-02-19 13:38:50] [EMAIL PROTECTED]

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

Thank you for your interest in PHP.

http://php.net/references



[2006-02-19 02:50:39] epoc_32 at yahoo dot co dot ukXXX

Description:

If you create an array inside array_pop(), expecting that array to be
popped then it isn't even though the last element of that array is
returned as expected.

Creating the array on the previous line makes array_pop() behave as
expected.

This behaviour doesn't occur in PHP4.3.x on FreeBSD. I only noticed it
when I upgraded to PHP 5.1.2 on my home WinXP machine though it's
possible it was broken but I didn't notice it in 5.0.x

Reproduce code:
---
$a=array(0, 1, 2, 3, 4, 5); // Set array first.
$offcut=array_pop($a); // Then pop array.
$length=count($a);
echo"Array offcut: "
.$offcut."\nArray length: "
.$length."\nLast element: "
.$a[$length-1]."\n";

$offcut=array_pop($a=array(0, 1, 2, 3, 4, 5)); // Set and pop at the
same time.
$length=count($a);
echo"Array offcut: "
.$offcut."\nArray length: "
.$length."\nLast element: "
.$a[$length-1]."\n";


Expected result:

Array offcut: 5
Array length: 5
Last element: 4

Array offcut: 5
Array length: 5
Last element: 4


Actual result:
--
Array offcut: 5
Array length: 5
Last element: 4

Array offcut: 5
Array length: 6
Last element: 5






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


#36451 [NEW]: Array doesn't pop when array is created inside array_pop

2006-02-18 Thread epoc_32 at yahoo dot co dot ukXXX
From: epoc_32 at yahoo dot co dot ukXXX
Operating system: Windows XP
PHP version:  5.1.2
PHP Bug Type: Scripting Engine problem
Bug description:  Array doesn't pop when array is created inside array_pop

Description:

If you create an array inside array_pop(), expecting that array to be
popped then it isn't even though the last element of that array is
returned as expected.

Creating the array on the previous line makes array_pop() behave as
expected.

This behaviour doesn't occur in PHP4.3.x on FreeBSD. I only noticed it
when I upgraded to PHP 5.1.2 on my home WinXP machine though it's possible
it was broken but I didn't notice it in 5.0.x

Reproduce code:
---
$a=array(0, 1, 2, 3, 4, 5); // Set array first.
$offcut=array_pop($a); // Then pop array.
$length=count($a);
echo"Array offcut: "
.$offcut."\nArray length: "
.$length."\nLast element: "
.$a[$length-1]."\n";

$offcut=array_pop($a=array(0, 1, 2, 3, 4, 5)); // Set and pop at the same
time.
$length=count($a);
echo"Array offcut: "
.$offcut."\nArray length: "
.$length."\nLast element: "
.$a[$length-1]."\n";


Expected result:

Array offcut: 5
Array length: 5
Last element: 4

Array offcut: 5
Array length: 5
Last element: 4


Actual result:
--
Array offcut: 5
Array length: 5
Last element: 4

Array offcut: 5
Array length: 6
Last element: 5


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


#30039 [NEW]: HTTP 'Content-Language' header gets double value when 'en' is used

2004-09-09 Thread epoc_32 at yahoo dot co dot ukXXX
From: epoc_32 at yahoo dot co dot ukXXX
Operating system: FreeBSD 4.8
PHP version:  4.3.8
PHP Bug Type: Output Control
Bug description:  HTTP  'Content-Language' header gets double value when 'en' is used

Description:

I am using the following line in a script:

   header('Content-Language: '.$PAGE['lang']);

If $PAGE['lang'] is 'no' then the http header gets sent as expected:

   Content-Language: no

However when $PAGE['lang'] is 'en' (and it definately is just 'en' without
any whitespace or uppercase characters) then this gets sent instead:

   Content-Language: en, en

Is this a bug or am I not understanding something? Or maybe something
Apache's doing afterwards? (I have version 1.3.29)

I did some testing and it seems the first 'en' is my string and the second
one is being added if that's of any help.


Reproduce code:
---
// English
header('Content-Language: en');

// Norwegian
header('Content-Language: no');


Expected result:

Content-Language: en
Content-Language: no

Actual result:
--
Content-Language: en, en
Content-Language: no

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