#35470 [Csd]: Assigning global using variable name from array doesn't function

2005-11-30 Thread prgallier at yahoo dot com
 ID:   35470
 User updated by:  prgallier at yahoo dot com
 Reported By:  prgallier at yahoo dot com
 Status:   Closed
 Bug Type: Scripting Engine problem
 Operating System: *
 PHP Version:  5CVS-2005-11-29 (cvs)
 Assigned To:  dmitry
 New Comment:

Tested and working great here.  Kudos to Dmitry!


Previous Comments:


[2005-11-30 11:10:53] [EMAIL PROTECTED]

Fixed in CVS HEAD and PHP_5_1.



[2005-11-29 20:11:25] [EMAIL PROTECTED]

?php
function dotest()
{
$array = array(array(test, blah),array(test, blah));
$i = 0;
  while ($row = $array[$i++])
  {
  global ${$row[0]};
  ${$row[0]} = $row[1];
  }
}

dotest();
?

Valgrind shows several errors:
==3742== Invalid read of size 4
==3742==at 0x823AAEA: zend_fetch_dimension_address
(zend_execute.c:1092)
==3742==by 0x826DEE0: ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER
(zend_vm_execute.h:20390)
==3742==by 0x823B348: execute (zend_vm_execute.h:88)
==3742==by 0x823B7A9: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:222)
==3742==by 0x823E294: ZEND_DO_FCALL_SPEC_CONST_HANDLER
(zend_vm_execute.h:1578)
==3742==by 0x823B348: execute (zend_vm_execute.h:88)
==3742==by 0x8214E75: zend_execute_scripts (zend.c:1090)
==3742==by 0x81D43AD: php_execute_script (main.c:1704)
==3742==by 0x828025D: main (php_cli.c:1039)

etc.



[2005-11-29 19:58:50] prgallier at yahoo dot com

The following generates a segfault on my system:

function dotest()
{
  $link = mysql_connect(localhost,test,test);
  mysql_select_db(test);
  mysql_query(CREATE TABLE config (num smallint(5) unsigned NOT NULL
auto_increment, conf varchar(20) NOT NULL default ''));
  mysql_query(INSERT INTO config (conf,type) VALUES('Test1','33'));
  $result = mysql_query(SELECT conf,value FROM config);
  while ($row = mysql_fetch_row($result))
  {
global ${$row[0]};
${$row[0]} = $row[1];
  }
  mysql_free_result($result);
}

dotest();
echo Test: $testbr\n;



[2005-11-29 13:09:49] [EMAIL PROTECTED]

Dmitry, can you check this out please.



[2005-11-29 11:33:26] prgallier at yahoo dot com

Oops...the expected and actual result fields are switched.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35470

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


#35470 [NEW]: Assigning global using variable name from array doesn't function

2005-11-29 Thread prgallier at yahoo dot com
From: prgallier at yahoo dot com
Operating system: Linux 2.6
PHP version:  5.1.1
PHP Bug Type: *General Issues
Bug description:  Assigning global using variable name from array doesn't 
function

Description:

The below code does not store the value 55 in the variable test as it
should, and did in PHP 5.0.5.  Leaving out the global declaration allows
the output to display properly.  I have also had segmentation faults
caused by similar routines, but have been unable to reproduce this outside
of the full program.

Reproduce code:
---
$x = array(test, 55);
global ${$x[0]};
${$x[0]} = $x[1];
echo Test: $testbr\n;;


Expected result:

Displays:
Test: 

Actual result:
--
Should display:
Test: 55


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


#35470 [Opn]: Assigning global using variable name from array doesn't function

2005-11-29 Thread prgallier at yahoo dot com
 ID:   35470
 User updated by:  prgallier at yahoo dot com
 Reported By:  prgallier at yahoo dot com
 Status:   Open
 Bug Type: *General Issues
 Operating System: Linux 2.6
 PHP Version:  5.1.1
 New Comment:

Oops...the expected and actual result fields are switched.


Previous Comments:


[2005-11-29 11:32:20] prgallier at yahoo dot com

Description:

The below code does not store the value 55 in the variable test as
it should, and did in PHP 5.0.5.  Leaving out the global declaration
allows the output to display properly.  I have also had segmentation
faults caused by similar routines, but have been unable to reproduce
this outside of the full program.

Reproduce code:
---
$x = array(test, 55);
global ${$x[0]};
${$x[0]} = $x[1];
echo Test: $testbr\n;;


Expected result:

Displays:
Test: 

Actual result:
--
Should display:
Test: 55






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


#35470 [Asn]: Assigning global using variable name from array doesn't function

2005-11-29 Thread prgallier at yahoo dot com
 ID:   35470
 User updated by:  prgallier at yahoo dot com
 Reported By:  prgallier at yahoo dot com
 Status:   Assigned
 Bug Type: Scripting Engine problem
 Operating System: *
 PHP Version:  5CVS-2005-11-29 (cvs)
 Assigned To:  dmitry
 New Comment:

The following generates a segfault on my system:

function dotest()
{
  $link = mysql_connect(localhost,test,test);
  mysql_select_db(test);
  mysql_query(CREATE TABLE config (num smallint(5) unsigned NOT NULL
auto_increment, conf varchar(20) NOT NULL default ''));
  mysql_query(INSERT INTO config (conf,type) VALUES('Test1','33'));
  $result = mysql_query(SELECT conf,value FROM config);
  while ($row = mysql_fetch_row($result))
  {
global ${$row[0]};
${$row[0]} = $row[1];
  }
  mysql_free_result($result);
}

dotest();
echo Test: $testbr\n;


Previous Comments:


[2005-11-29 13:09:49] [EMAIL PROTECTED]

Dmitry, can you check this out please.



[2005-11-29 11:33:26] prgallier at yahoo dot com

Oops...the expected and actual result fields are switched.



[2005-11-29 11:32:20] prgallier at yahoo dot com

Description:

The below code does not store the value 55 in the variable test as
it should, and did in PHP 5.0.5.  Leaving out the global declaration
allows the output to display properly.  I have also had segmentation
faults caused by similar routines, but have been unable to reproduce
this outside of the full program.

Reproduce code:
---
$x = array(test, 55);
global ${$x[0]};
${$x[0]} = $x[1];
echo Test: $testbr\n;;


Expected result:

Displays:
Test: 

Actual result:
--
Should display:
Test: 55






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


#20548 [WFx]: Decrement ($x[$y]--) doesn't work on uninitiated variable

2003-09-27 Thread prgallier at yahoo dot com
 ID:   20548
 User updated by:  prgallier at yahoo dot com
 Reported By:  prgallier at yahoo dot com
 Status:   Wont fix
 Bug Type: Scripting Engine problem
 Operating System: Linux 2.4
 PHP Version:  4.3.2-dev
 New Comment:

There are plenty of workarounds, but the problem is the lack of
consistency.  Either you can or you can't use uninitialized variables. 
If you can use $test[0]++ you should be able to use $test[0]-- as well
(no, I don't think they should drop the ability to use direct
increments/decrements).


Previous Comments:


[2003-09-27 16:47:47] [EMAIL PROTECTED]

IMO, using unitialized variables should cause a FATAL error.
Just initialize the variables you use.




[2003-09-27 14:38:53] lew at mailduct dot com

PHP 4.3.3 on FreeBSD 4.8-RELEASE:
?php

//  Increment some blank/empty variables...
$pos++; $pos++; $pos++;
$neg--; $neg--; $neg--;
//  Show them to us now...
print( pos = $pos\n );
print( neg = $neg\n );

//  Now do it another way (forced typecast)...
$ppp += 1; $ppp += 1; $ppp += 1;
$nnn -= 1; $nnn -= 1; $nnn -= 1;
//  Show them to us now...
print( ppp = $ppp\n );
print( nnn = $nnn\n );

#
#  Expected:
#pos = 3ppp = 3
#neg = -3   nnn = -3
#
#  Actual:
#pos = 3ppp = 3
#neg =  nnn = -3
?



[2003-09-27 14:36:59] lew at mailduct dot com

This is a GROSS inconsistency in how the increment/decrement operators
work, and one that coders are likely to stumble upon the hard way.
Please study the effect of fixing this, at the expense of breaking a
long-time quirk in BC. Breaking a quirk, and documenting it on the BC
page, is better than maintaining a GROSS inconsistency in one of the
basic language construct operators!  Please fix this!



[2003-08-03 12:57:49] [EMAIL PROTECTED]

This is a valid bug, however a fix would be a BC break that would
result in a beahviour change that was in place since 3.0 days.



[2003-02-14 17:14:59] bulletbait at yahoo dot com

I just stumbled across this bug recently with an older version (4.1.1)
of PHP on Win32 -- verified that it still exists in 4.3.0.  This one
had me going in circles trying to debug.  Work-arounds:

  $score[$num] -= 1;

or
  $score[$num] = $score[$num] - 1;



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/20548

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


#24030 [NEW]: sprintf with negative floating point type leaves null in string

2003-06-05 Thread prgallier at yahoo dot com
From: prgallier at yahoo dot com
Operating system: Linux 2.4.20
PHP version:  4.3.2
PHP Bug Type: Strings related
Bug description:  sprintf with negative floating point type leaves null in string

Using sprintf with a floating point value for a negative number leaves a
null character in the string, such as:
$num = sprintf(%0.1f, -12.5);

$num will contain the following characters within the actual string when
printing out:
0x45 0x31 0x32 0x2E 0x35 0x00

This does not occur with non-negative numbers.

Try the following for realtime example:
?php
$num = sprintf(%0.1f, 12.5);
echo Positive Num: $numbr\n;
$num = sprintf(%0.1f, -12.5);
echo Negative Num: $numbr\n;
?

This is apparently an old bug that's been reintroduced in version 4.3.2.

-- 
Edit bug report at http://bugs.php.net/?id=24030edit=1
-- 
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24030r=trysnapshot
Fixed in CVS:   http://bugs.php.net/fix.php?id=24030r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=24030r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24030r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=24030r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=24030r=support
Expected behavior:  http://bugs.php.net/fix.php?id=24030r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=24030r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=24030r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=24030r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24030r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=24030r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=24030r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=24030r=gnused