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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:12:40+00:00 2026-06-15T21:12:40+00:00

I have a class and the commented line is failing (clearly because I don’t

  • 0

I have a class and the commented line is failing (clearly because I don’t need the $ before displayname), however I ended up having to put a bunch of echo statements in to figure that out because an error isn’t being thrown.

I’m hoping there is a way.

class RegisterModel {
    var $displayname;
    ...
    function RegisterModel() {
        try {
            if (empty($_POST) === false) {
                // THIS LINE IS FAILING ... BUT I'M NOT GETTING AN ERROR
                // I KNOW WHY IT'S FAILING ... BUT I WANT AN ERROR TO THROW
                $this->$displayname = $_POST['displayname'];
                ...
            }
        }
        catch (Exception $e) {
            echo $e->getMessage();
        }
    }
}

Should the error be getting thrown into the catch and I’m just not using it right? Is there some global setting I need to set so that the errors are thrown?

  • 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-06-15T21:12:41+00:00Added an answer on June 15, 2026 at 9:12 pm
    set_error_handler(function($errno ,$errstr,$errfile,$errline,$errcontext){
       if($errno & error_reporting()) throw new Exception($errstr,$errno);
    });
    

    Keep in mind you want to set error_reporting to your desired level.

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

Sidebar

Related Questions

I have a block of code below with a single line commented out. What
I have simple class but with anonymous block of code. I need to cover
I have a Comment class with a :foreign_key of post_id in the Post class.
I have a Post Class and a Comment Class. I have a post object
I have two models related one-to-many: a Post and a Comment : class Post(models.Model):
In my Rails 2.3.2 app I have 2 models: class Post has_many :approved_comments, :class_name
I am using Rails 3.2. I have following models: Blog Comment User class Blog
I have two ActiveRecord models of the same class: #1: represents the current committed
So, say I have models like this: class Foo(Model): name = CharField(max_length=200) def latest_comment(self):
I have the code like this $output.='<li class='.$rcclass.'>' . /* translators: comments widget: 1:

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.