0

Hi i got after a Update to PHP 5.5.9 a Problem with my PHP Code. Can some one help me ?

}

public function update($_REQUEST) {
    $form = this->createForm('', @$_REQUEST['aID']);
    //$form->showQuery = true;
    $form->saveExistingEntry();

    return '<h1 class="go">Gespeichert</h1>';
}
Attix2508
  • 5
  • 1
  • 5
  • $_REQUEST is an auto-global. You don't pass it in the parameters. It is global. Just remove it from the parameter list of the function. – kainaw Mar 25 '15 at 18:31

1 Answers1

1

What this error is saying is that you are attempting to name a variable in the function $_REQUEST. That is a reserved variable name. You cannot create your own variable with that name. But, you say, I don't think I'm that!? Yes. By making a parameter of your function named $_REQUEST, you are saying: Within this function, I have a variable that I will name $_REQUEST. So, you are attempting to create a variable named $_REQUEST.

So, the fix...

public function update() {

That avoids naming a variable $_REQUEST. But, how can you access $_REQUEST inside the function? It is an auto-global. It exists everywhere. Therefore, your attempt to access $_REQUEST['aID'] will work even though you didn't put $_REQUEST in the parameter.

kainaw
  • 4,256
  • 1
  • 18
  • 38
  • I changed it, i got the next failure... i'm sorry... i'm realy a noob in PHP. Now i got Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in Line 35 – Attix2508 Mar 25 '15 at 18:48
  • Because you have "this" without the "$". It should be "$this". In PHP, all variables begin with $. – kainaw Mar 25 '15 at 18:49