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 6153593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:07:11+00:00 2026-05-23T20:07:11+00:00

I am unable to override a function in a child class at my local

  • 0

I am unable to override a function in a child class at my local Ubuntu test LAMP server, but the very same code is resulting in the desired override when uploaded to a webserver.

Original class:

class HandsetDetection {
    function HandsetDetection() {
        //code I wish to replace
    }
}

My class:

class HandsetDetection_RespondHD extends HandsetDetection {
    function HandsetDetection() {
        //code I wish to use
    }
}

Constructors aren’t involved.

The version of PHP in use on my local machine is PHP 5.3.3-1ubuntu9.5 with Suhosin-Patch (cli) (built: May 3 2011 00:48:48)

The version of PHP on the webserver where the override is successful is 5.2.17

Can you think why this may be?

  • 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-23T20:07:11+00:00Added an answer on May 23, 2026 at 8:07 pm

    Replace HandsetDetection() / prevent it from being called by giving the extending class a constructor method (Demo):

    <?php
    
    class A {
    
        function A() {
            echo "A() constructor\n";
        }
    }
    
    class B extends A {
    
        function __construct() {
            echo 'B() constructor', "\n";
        }
    
        function A() {
            echo "override\n";
        }
    
    }
    
    $x = new B();
    

    Then things should turn out well. For an explanation about the background info, see @edorians answer with links to the manual etc.

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

Sidebar

Related Questions

I have this code but I am unable to find out how it is
This is my .java code public class MainHelp extends PreferenceActivity { @Override public void
Here is the code: public class BillingService extends Service implements ServiceConnection { ... @Override
I am unable to override Sales Rule Model. I want to override class Mage_SalesRule_Model_Rule
I am unable to override attributes when using <include> in my Android layout files.
I have a standard windows server that inherits from the ServiceBase class. On the
This is a bit hard to explain, but I seem to be occasionally unable
As the question suggests I know we can't override the Home key event but
I am using C#. I am having below code in C#: protected override void
I am unable to register my BroadcastReceiver. Whenever I try to execute my code

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.