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

  • SEARCH
  • Home
  • 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 3666042
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:50:00+00:00 2026-05-19T01:50:00+00:00

I am getting the warning: Call-time pass-by-reference has been deprecated for the following lines

  • 0

I am getting the warning: Call-time pass-by-reference has been deprecated for the following lines of code:

function XML() {
    $this->parser = &xml_parser_create();
    xml_parser_set_option(&$this->parser, XML_OPTION_CASE_FOLDING, false);
    xml_set_object(&$this->parser, &$this);
    xml_set_element_handler(&$this->parser, 'open','close');
    xml_set_character_data_handler(&$this->parser, 'data');
}
function destruct() {
    xml_parser_free(&$this->parser);
}
function & parse(&$data) {
    $this->document = array();
    $this->stack    = array();
    $this->parent   = &$this->document;
    return xml_parse(&$this->parser, &$data, true) ? $this->document : NULL;
}

What does it cause and how to fix it?

  • 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-19T01:50:00+00:00Added an answer on May 19, 2026 at 1:50 am

    Remove & from &$this everywhere, it is not needed. In fact, I think you can remove & everywhere in this code – it is not needed at all.

    Long explanation

    PHP allows to pass variables in two ways: “by value” and “by reference”. First way (“by value”), you can’t modify them, other second way (“by reference”) you can:

         function not_modified($x) { $x = $x+1; }
         function modified(&$x) { $x = $x+1; }
    

    Note the & sign. If I call modified on a variable, it will be modified, if I call not_modified, after it returns the value of the argument will be the same.

    Older version of PHP allowed to simulate behavior of modified with not_modified by doing this: not_modified(&$x). This is “call-time pass by reference”. It is deprecated and should never be used.

    Additionally, in very ancient PHP versions (read: PHP 4 and before), if you modify objects, you should pass it by reference, thus the use of &$this. This is neither necessary nor recommended anymore, as object are always modified when passed to function, i.e. this works:

       function obj_modified($obj) { $obj->x = $obj->x+1; }
    

    This would modify $obj->x even though it formally is passed “by value”, but what is passed is object handle (like in Java, etc.) and not the copy of the object, as it was in PHP 4.

    This means, unless you’re doing something weird, you almost never need to pass object (and thus $this by reference, be it call-time or otherwise). In particular, your code doesn’t need it.

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

Sidebar

Related Questions

I'm getting this problem: PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable
We are getting the following warning from Code Analysis in Visual Studio 2010 and
I am getting the following warning from my NetBeans IDE. Suspicious call to java.util.Collection.contains
We've been avoiding this PMD warning by moving most of our constructor code into
I'm getting a warning from ReSharper about a call to a virtual member from
I am getting this warning: Use of uninitialized value in eval \string\ at myscript.pl
I am getting the following errors: PHP Warning: Module 'ldap' already loaded in Unknown
Getting two warning when i run this program and i can't figure out how
I am getting this warning when I try to set my user name in
I'm getting a warning in the following method: - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn

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.