Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4611286
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:14:51+00:00 2026-05-22T01:14:51+00:00

This is somewhat the second part to this question . In my project, I

  • 0

This is somewhat the second part to this question.

In my project, I have the following interface:

interface ISoapInterface {
  public static function registerSoapTypes( wsdl &$wsdl );
  public static function registerSoapOperations( NuSoapServer &$server );
  public static function registerFaultHandler( $callback );
  public static function handleFault( $faultcode, $faultstring, $faultdetail );
  public static function userInfo( User $user );
}

Now I have several classes that implement this interface and I want to call several of these methods on each of those classes.

So there are 2 ways I can invoke those methods. The pre-5.3 version:

call_user_func_array( array( $provider, "registerSoapTypes" ), array( $server->wsdl ) );

And the post-5.3 version:

$provider::registerSoapTypes( $server->wsdl );

Now, my problem is, the pre-5.3 version doesn’t work at all in 5.3.3.
Parameter 1 to Foo::registerSoapTypes() expected to be a reference, value given
Even though I am pretty sure it worked fine with 5.3.0. The documentation also states:

Referenced variables in param_arr are passed to the function by reference, regardless of whether the function expects the respective parameter to be passed by reference. This form of call-time pass by reference does not emit a deprecation notice, but it is nonetheless deprecated, and will most likely be removed in the next version of PHP.

So I thought I was being real smart by cooking this up:

$soapProvider = array( "Foo", "Bar", "Foo2", "Bar2" );
foreach( $soapProvider as $provider ) {

  if( !defined( "PHP_VERSION_ID" ) ) {
    $version = explode( ".", PHP_VERSION );
    define( "PHP_VERSION_ID", ( $version[ 0 ] * 10000 + $version[ 1 ] * 100 + $version[ 2 ] ) );
  }

  if( PHP_VERSION_ID > 50300 ) {
    // Use simple calling method on systems running PHP 5.3.0 or higher
    $provider::registerSoapTypes( $server->wsdl );
    $provider::registerSoapOperations( $server );
    $provider::registerFaultHandler( "faultHandler" );
    $provider::userInfo( $user );

  } else {
    call_user_func_array( array( $provider, "registerSoapTypes" ), array( $server->wsdl ) );
    call_user_func_array( array( $provider, "registerSoapOperations" ), array( $server ) );
    call_user_func_array( array( $provider, "registerFaultHandler" ), array( "faulthandler" ) );
    call_user_func_array( array( $provider, "userInfo" ), array( $user ) );
  }
}

Turns out, it wasn’t smart at all, as $provider::something() generates a parser error (Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM).

So, what is the way of calling those static methods on those classes (when the class name is provider as a string) that works on PHP 5.2.6 (Debian 5) through 5.3.3 (Debian 6).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:14:52+00:00Added an answer on May 22, 2026 at 1:14 am

    As Znarkus wrote, you’re not passing a reference to Foo::registerSoapTypes,

    so just add an & to those parameters that need to be passed as references, in the second parameter of your call_user_func_array

    call_user_func_array( array( $provider, "registerSoapTypes" ), array( &$server->wsdl ) );
    

    But if not all your methods expects the parameters to be a reference, you could run into some problems, so maybe it’s safer to construct the $args for call_user_func_array using some reflection.

    See: http://www.php.net/manual/en/book.reflection.php

    and especially: http://www.php.net/manual/en/reflectionparameter.ispassedbyreference.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is somewhat of a follow-up question to this question . Suppose I have
Although somewhat related to this question , I have what I think is a
This is somewhat a two-part question (please let me know if they should be
This is somewhat of a follow-up to an answer here . I have a
I know this is somewhat of a server question, but I wanted to ask
This is a somewhat low-level question. In x86 assembly there are two SSE instructions:
This is a somewhat bizarre question. My objectives are to understand the language design
[This question is somewhat related to this question , but the answers are not...]
I have a list of items that is somewhat like this: [ [orange, 9],
I'm posting this question which is somewhat a summary of my other question .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.