title: Cunstructor invocation failed using ReflectionClass in php
body: <p>Following code was working earlier but now it's throwing error constructor invocation of class xyz failed, I have added the code that will help to understand the issue. </p>
  
  <p>code:</p>
  
  <pre><code>public static function &amp; Instance( $class )
  
   {
  
    static $loaded = array();
  
    if ( !( isset( $loaded[ $class ] ) ) ) {
  
     $c = SPLoader::loadClass( $class, false, null, false );
  
     if ( !( strlen( $c ) ) ) {
  
      $c = SPLoader::loadClass( $class, defined( 'SOBIPRO_ADM' ) );
  
     }
  
     if ( !( strlen( $c ) ) ) {
  
      throw new SPException( SPLang::e( 'Cannot create instance of "%s". Class file does not exist', $class ) );
  
     }
  
     $loaded[ $class ] = $c;
  
    }
  
    $args = func_get_args();
  
    unset( $args[ 0 ] );
  
    try {
  
     $obj = new ReflectionClass( $loaded[ $class ] );
  
     $instance = $obj-&gt;newInstanceArgs( $args );
  
    } catch ( LogicException $Exception ) {
  
     throw new SPException( SPLang::e( 'Cannot create instance of "%s". Class file does not exist. Error %s', $class, $Exception-&gt;getMessage() ) );
  
    } catch ( ReflectionException $Exception ) {
  
     throw new SPException( SPLang::e( 'Cannot create instance of "%s". Class file does not exist. Error %s', $class, $Exception-&gt;getMessage() ) );
  
    }
  
    return $instance;
  
   }
  </code></pre>
  
  <p>Constructor class:</p>
  
  <pre><code>class SPImexExportDownload
  
  {
  
      /**
  
       * @var SPImexCtrl
  
       */
  
      protected $proxy = null;
  
  
  
      public function __construct( SPImexCtrl &amp;$proxy )
  
      {
  
          $this-&gt;proxy =&amp; $proxy;
  
      }
  
  
  
      public function data( $field )
  
      {
  
          $data = $field-&gt;getRaw();
  
          $out = array();
  
          try {
  
              $data = SPConfig::unserialize( $data );
  
              if ( count( $data ) ) {
  
                  // "{'label':'Nothing Special','protocol':'http','url':'radek.suski.eu'}"
  
                  if ( isset( $data[ 'label' ] ) &amp;&amp; $data[ 'label' ] ) {
  
                      $out[ ] = $data[ 'label' ];
  
                  }
  
                  $out[ ] = $data[ 'protocol' ] . '://' . $data[ 'url' ];
  
              }
  
          }
  
          catch ( SPException $x ) {
  
              $this-&gt;proxy-&gt;log( $field-&gt;get( 'nid' ) . ": " . $x-&gt;getMessage(), 'error' );
  
              $data = null;
  
          }
  
          return $out;
  
      }
  
  }
  </code></pre>
  
  <p>My PHP Version: 5.6</p>