Announcement

Collapse
No announcement yet.

PHP code generation - scoped variable problem

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP code generation - scoped variable problem

    In an afterInsert event, I provide the following code:

    Code:
    if( sc_changed( {Gravity_Factor} ) ) {
     $gravity_factor = sc_sql_injection({Gravity_Factor});
     $sql .= "Gravity_Factor";
     $sqlv .= "'".$gravity_factor."'";
    }
    That produces this generated code:

    Code:
    if($this->nmgp_dados_form['gravity_factor'] != $this->gravity_factor ) {
            $this->gravity_factor = $this->Db->qstr($this->gravity_factor );
            $sql .= "Gravity_Factor";
            $sqlv .= "'".$gravity_factor."'";
    }
    Which produces a runtime error because $gravity_factor is undefined, because it has not been explicitly scoped to the class.

    There are a number of potential errors made likely here, because ScriptCase does not preserve the variable name case. Ouch!

    But it's the scoping issue that I'm reporting, which looks like a string parsing problem for the event code.

  • #2
    You can create variables with app scope in scriptcase: in Programming and Atributes, and you can use this variable like that: {var_name}

    Comment


    • #3
      If you want i can show in skype sharing my desktop.

      Comment


      • #4
        Hello,

        Issue reported to our bugs team.

        regards,
        Bernhard Bernsmann

        Comment


        • #5
          Thanks Paulo. I know how to work around the problem, but the vendor needs to know about the problem so that, eventually, we won't have a problem to work around.

          Then there will be peace, happiness, and cake.

          Comment


          • #6
            In this post I suggested a good thing for us (scriptcase's clients):

            http://www.scriptcase.net/forum/show...3719#post23719

            Comment

            Working...
            X