-1

this code

    $obj = &new Crypt_RSA($params, $wrapper_name, $error_handler);

have this error :

Parse error :syntax error,unexpected 'new' (T_NEW) in /var/www/html/shares/RSA.php

can anyone help ,thanks

neubert
  • 15,947
  • 24
  • 120
  • 212
It Afarin
  • 31
  • 1
  • 2
  • 1
    And try this search on Google: _Assigning the return value of new by reference is deprecated_ – Tom Udding Dec 02 '17 at 10:02
  • FWIW the OP is using https://pear.php.net/package/Crypt_RSA which has long been abandoned. – neubert Dec 02 '17 at 17:14
  • this question is relevant for those of us who searched for this PHP error using the exact error syntax. i believe it's a very useful question. – edwardsmarkf Sep 11 '20 at 01:05

1 Answers1

3

As indicated in the comments - using a reference in assignment is deprecated, so

$obj = &new Crypt_RSA($params, $wrapper_name, $error_handler);

should be

$obj = new Crypt_RSA($params, $wrapper_name, $error_handler);

(Remove the ampersand (&) before new).

Tom Udding
  • 2,264
  • 3
  • 20
  • 30
Nigel Ren
  • 56,122
  • 11
  • 43
  • 55
  • thanks,but afther correct this. – It Afarin Dec 03 '17 at 07:38
  • Not sure what you mean? This change doesn't need any more code changes, but you may get new errors once this is fixed. – Nigel Ren Dec 03 '17 at 07:59
  • yes after change code this error occur :warning: Declaration of Digital_Signature::CreateSign() should be compatible with Crypt_RSA::createSign($document, $private_key = NULL, $hash_func = NULL) – It Afarin Dec 03 '17 at 08:13
  • This is probably related to the comment on your question about the Crypt_RSA not being maintained anymore. That is way beyond the scope of this question and should be raised as a new question if you can't find an solution first. – Nigel Ren Dec 03 '17 at 08:16