ID: 17290
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Arrays related
Operating System: Linux
PHP Version: 4.1.2
New Comment:
I occured a similar error when using (also on lx-machine)
while ($db->next_record())
{
/* Fix for php 4.2.1 */
$foo=$db->f('RIS_VSR_FK');
$curstate[$foo] = $db->f('RIS_ALLOWED');
/* End Fix
$curmain[$db->f('RIS_VSR_FK')] = $db->f('RIS_ISMAIN');
<-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
$defmainvs = $db->f('RIS_ISMAIN') == 'YES' ? $db->f('RIS_VSR_FK') :
$defmainvs;
}
Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ']'
in xxx on line 166 <-!!!!!!!!!!!! this line
That means that accessing an object in a class instance and using this
as the arrays index also does not work, using a simple variable does
work.
Probably there is a major bug in the parser (priority?), because the
workaround with $array[{$array_b[1][2]}], which I would expect that
first {$array_b[1][2]} is evaluated and then $array[$evaluation_result]
gets the error that no {} are allowed. I am not sure this is a new bug,
but I remember in 4.0.x it always worked fine.
Previous Comments:
------------------------------------------------------------------------
[2002-05-17 11:02:29] [EMAIL PROTECTED]
I've build an array using the following in a function :
-------------
$this->get_data(array("","","and D.XiParentId= 'gwak_root_element'
ORDER BY D.vcOrder"));
$arrCategory = $this->return_array();
for($i = 0 ; $i < sizeof($arrCategory) ; $i++) {
$this->get_data(array("","","and D.XiParentId = '" .
$arrCategory[$i]["XiDataId"] . "' ORDER BY D.vcOrder"));
$arrItem[$arrCategory[$i]["vcItemId"]] =
$this->return_array();
}
return $arrItem;
-------------
This constructs an array with values like :
$arrItem["project_priority"][0] = array(...)
$arrItem["project_priority"][1] = array(...)
etc...
Later I tried to do the following to the returned $arrItem :
-------------
$arrItem["project_severity"][] = array("XiDataId" => "gwak_get_all",
"vcText" => "All");
-------------
This gives the error :
-------------
Fatal error: Cannot use [] for reading in
/home/plb/public_html/gwak/module/project/include/Task.class.php on
line 160
-------------
Funny because doing the following :
-------------
$arrThis["here"][] = array("XiDataId" => "asdasdas", "vcText"
=> "324234234");
$arrThis["here"][] = array("XiDataId" => "asdasdas", "vcText"
=> "324234234");
$arrThis["here"][] = array("tr" => "ert");
$arrThis["where"][] = array("er" => "ert");
$arrThis["where"][] = array("we" => "ert");
$arrThis["where"][] = array("tr" => "ert");
-------------
gives no error at all, eventhough $arrThis and $arrItem have exactly
the same format. Do you guys have an idea what is going on here?
The only thing i can see could cause the problem is that $arrItem is
built using "arrays within arrays":
$arrItem[$arrCategory[$i]["vcItemId"]] = array(...);
Can this be the cause or...
In advance thx...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17290&edit=1