Announcement

Collapse
No announcement yet.

call_user_func cannot work in Scriptcase but works out of Scriptcase

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

  • call_user_func cannot work in Scriptcase but works out of Scriptcase

    Hi, guys:
    There's a important question for me and ask for help.

    In my Scriptcase project, a form applicaton, in it's OnLoad event, I write code like this:

    function increment($var)
    {
    echo $var . "DDDDD";
    }

    $a = 33;
    call_user_func('increment', $a);
    And it gets error, below:
    call_user_func() expects parameter 1 to be a valid callback, function 'increment' not found or invalid function name


    And just the PHP code, I save to a single php file named 1.php, it is:

    <?php
    function increment($var)
    {
    echo $var . "DDDDD";
    }

    $a = 33;
    call_user_func('increment', $a);
    ?>
    And I run it, like: http://127.0.0.1:88/scriptcase/1.php (which was exactly the Scriptcase runtime), and it runs perfectly.

    How's that going? Could you help me for this?

    Thank you very much.
    Last edited by jerry; 01-29-2015, 11:07 AM. Reason: format

  • #2
    It was fixed.

    Comment


    • #3
      Please, investigate and/or ask before to post on Bugs forums. Because this is not a bug, but using incorrectly SC.

      Moving.
      /Giuseppe

      Professional Scriptcase Services
      Some Customers opinions

      Comment


      • #4
        and the fix was....to use $this->increment ? :-)

        Comment


        • #5
          I should explain here.

          Not $this->increment, because the function name is unknown(I put the function name into the database), because there's a class for Scriptcase-created form, so we should call like this: call_user_func(array(get_class($this), $myfunc)

          Comment

          Working...
          X