Call-time pass-by-reference has been deprecated - error

Discussion in 'PHP' started by misohoni, Oct 2, 2008.

  1. #1
    I've got this warning due to moving a site to a new server.

    Off the top of my head it's to do with a function not switched on in php.ini, however I'm not able to modify the ini file on the server.

    This is the full error I get:

    Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /#/local/home/#/index.php on line 28
    Code (markup):
    The files in question are:

    $php_file1 = getRandomImage1($path_to_pages1, $default_file1, &$img1); 
    $php_file2 = getRandomImage2($path_to_pages2, $default_file2, &$img2); 
    $php_file3 = getRandomImage3($path_to_pages3, $default_file3, &$img3); 
    Code (markup):

    I know it relates to the "&" before $img1/2/3, but I tried to remove it and place an array(xx) around it but still no luck - any advice?

    Thanks
     
    misohoni, Oct 2, 2008 IP
  2. zac439

    zac439 Notable Member

    Messages:
    3,074
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    260
    #2
    You mentioned the problem wasn't in your PHP.INI file- try restarting the PHP engine and see what happens. Also, ensure that allow_call_time_pass_reference is set to true.

    Let us know how it goes :D
     
    zac439, Oct 2, 2008 IP
  3. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #3
    No I think if I had access to php.ini then the problem would be solved, but I'm hosted with Dreamhost and they won't let me touch it!

    My thinking was just change the current code. I read that it relates to the & symbol, when I remove it the errors go...but no images (with relative url) are displayed. I sort of used a knocked-up Image Rotator on the site.
     
    misohoni, Oct 2, 2008 IP
  4. zac439

    zac439 Notable Member

    Messages:
    3,074
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    260
    #4
    Can you verify that allow_call_time_pass_reference is set to true? Just look at your php configuration and if it isn't, open a support ticket.

    Can we see what the image-getting function does in terms of code?
     
    zac439, Oct 2, 2008 IP
  5. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #5
    I don't think I can even access the php config. Dreamhost are pretty strict and already shot an email back saying they can't help. I'd imagine it's not set to true as I tested it on my own server (which was set to true) and it worked fine...

    Would you have an idea on changing the code?

    Thanks
     
    misohoni, Oct 2, 2008 IP
  6. zac439

    zac439 Notable Member

    Messages:
    3,074
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    260
    #6
    You mean you can't even put this in a script and run it? ;

    If you can't, it's time for a new host.
     
    zac439, Oct 2, 2008 IP
  7. Sillysoft

    Sillysoft Active Member

    Messages:
    177
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #7
    If they didnt disable it you can use ini_set
     
    Sillysoft, Oct 2, 2008 IP
  8. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #8
    Actually I think I can edit the php.ini file (although can't seem to access it via Putty), then I know I need to set to true:
    php_value allow_call_time_pass_reference

    Cheers!
     
    misohoni, Oct 2, 2008 IP