Menu

Cannot pass parameters to class extension

2007-05-25
2013-04-22
  • Nobody/Anonymous

    Hi,

    I'm compiled the class_demo and tried to add the print_text to the php page to test it. It truns out that although the parametercount=1 and the named parameter is present in the parameters collection it is null.

    Strangely enough do parameters work when adding a function directly to the extension (so without a TPHPClass.

    Any suggestions?

    Btw The bug was present in 6.2 and in the latest svn version. I tested with php 4.3.0 and 5.x both with the same result (without proper safeguards apache throws exceptions).

     
    • Serhiy Perevoznyk

      I did the test today with PHP 5.2.2 and Apache 2. class_demo works in this combination without problem or at least I had no any apache exceptions as you described.

      When parameter is not provided (ie $obj->print_text(); ) the error message is not really clear, indeed, but it's not a bug from my point of view.

       
    • G.W. van der Vegt

      Hi,

      I'm runnning Php 4.3.10. What i see is that the variables pass into the function are nil, altough the collection of parameters itself is correct (names and count are ok).

      Wim van der Vegt

       
    • G.W. van der Vegt

      Hi,

      Just checked and Php 5.2.0 gave exceptions when the class_demo dll is loaded. It's probably due to the fact that i only defined PHP5 and PHP520 in the ini file. After re-downloading from sourceforge's svn I saw the default inc file defines all PHP5 defines.

      After recompiling it works under Php 5.2.0 but still fails under Php 4.3.10. I had PHP4 and PHP433 defined during compilation. NO errors it just won't see any parameter values. The returnvalue works.

       
    • G.W. van der Vegt

      Hi,

      Just checked and Php 5.2.0 gave exceptions when the class_demo dll is loaded. It's probably due to the fact that i only defined PHP5 and PHP520 in the ini file. After re-downloading from sourceforge's svn I saw the default inc file defines all PHP5 defines.

      After recompiling it works under Php 5.2.0 but still fails under Php 4.3.10. I had PHP4 and PHP433 defined during compilation. NO errors it just won't see any parameter values. The returnvalue works.

       
    • Serhiy Perevoznyk

      Quick fix:

      in phpclass.pas line 331:

      replace
      M.Parameters[j].Value := zval2variant(Params[j]^^);
      to
      M.Parameters[j].ZendValue := (Params[j]^);

       

Log in to post a comment.