From:             webmaster at x7chat dot com
Operating system: Linux, Windows
PHP version:      4.3.3
PHP Bug Type:     Arrays related
Bug description:  Returns a Fatal error when using assign-ops

Description:
------------
A certain script I wrote uses the following line of code:

$USER['TEMP'] .= "!";

When I run this some servers (Programmed on Redhat Linux 9 with PHP 4.3.3
and it works fine, tested on another Linux server using PHP 4.3.3 and it
returns the error) it returns the following error message:

Fatal error: Cannot use assign-op operators with overloaded objects nor
string offsets in
(FILE PATH) on line (LINE NUMBER)

I have asked many different programmers about it and nobody has an answer
as to why it causes an error on code that is correct.  According to PHP
documentation the syntax of it is correct.  

Another person who has had this problem has documented it here:
http://www.faqchest.com/prgm/php-l/php-02/php-0205/php-020581/php02052416_25320.html.
 I distribute the script for free and I have had at least 4 different
users report that they are having this problem.

The variable $USER['TEMP'] has been defined before and is not null.

Reproduce code:
---------------
$q = DoQuery("SELECT * FROM $SERVER[TBL_PREFIX]users WHERE
username='$USER[NAME]'");
$USER['TEMP'] = $row[13];
$k = 1; $i = 0; $s = 0; $r[0] = "";
$USER['TEMP'] .= "!";
while($k){
$sub = substr($USER['TEMP'],$i,1);
if($sub == "!"){
$k = 0;
break;
}
if($sub == ","){
$s++;
}else{
@$r[$s] .= $sub;
}
$i++;
}

Expected result:
----------------
I would expect it to add "!" to $USER['TEMP'] every time it goes through
the while loop, on some servers it does but on others it returns the error
even if they are the same type of server running the same version of PHP.

Actual result:
--------------
On some servers it works correctly and on others it says:

Fatal error: Cannot use assign-op operators with overloaded objects nor
string offsets in
(FILE PATH) on line (LINE NUMBER)

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

Reply via email to