#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    150
    Rep Power
    3

    Question Fatal error: Call to a member function [...] on a non-object in


    Hi all,

    Wondering whats' going on here:

    $_POST['verify_code'] does have some text assigned to it.

    PHP Code:
    if ($_POST['verify_code'] != "") {
        include_once (
    'verify.php');
        
    $verify = new VerifyIt();
        
            if (
    $verify->check($_POST['verify_code']) == false) {   <-- THIS IS THE LINE IT ERRORS ON 
                $criticalError 
    .= "Error - The verification text entered did not match.  Please try again.<br>";
            }
    } else {
        
    $criticalError .= "Error - You must enter the verification text ...blah.<br>";

    The relavent code in verify.php:
    PHP Code:
    class VerifyIt
    {

    [
    i][snip][/i]

        public function 
    check($code)
        {
            
    $this->code_entered $code;
            
    $this->validate();
            return 
    $this->correct_code;
        }

    [
    i][snip][/i]



    Error is gives:
    Fatal error: Call to a member function check() on a non-object in ...
    Why would it say check() is a non object, when prior to that line I'm instantiating it: $verify = new VerifyIt();
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,002
    Rep Power
    9398
    Is that your exact code? You literally need to copy and paste it here.
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,866
    Rep Power
    6351
    var_dump($verify), I bet your constructor is wrong.

    Assuming this is actually your code and you didn't snip out a bunch of lines in your first example.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    150
    Rep Power
    3
    Yeah, the first PHP code piece is as it is in my script. Nothing was snipped from there, only the second PHP code was snipped.

    Placing the var_dump($verify) right after instantiating it, gives:

    object(VerifyIt)#1 (52) { ["image_width"]=> int(215) ["image_height"]=> int(80) ["i_type"]=> int(2) ["i_bg_color"]=> object(VerifyIt_Color)#2 (3) { ["r"]=> int(255) ["g"]=> int(255) ["b"]=> int(255) } ["text_color"]=> object(VerifyIt_Color)#3 (3) { ["r"]=> int(112) ["g"]=> int(112) ["b"]=> int(112) } ["line_color"]=> object(VerifyIt_Color)#4 (3) { ["r"]=> int(112) ["g"]=> int(112) ["b"]=> int(112) } ["noise_color"]=> object(VerifyIt_Color)#5 (3) { ["r"]=> int(112) ["g"]=> int(112) ["b"]=> int(112) }
    Note: I have to break up the var_dump because the forum gives me this error if I don't: You have included too many is in your signature or in your previous post. Please go back and correct the problem and then continue again. (and something about html and bb [] code).
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    150
    Rep Power
    3
    Continued:
    ["text_transparency_percentage"]=> int(50) ["use_transparent_text"]=> bool(false) ["code_length"]=> int(6) ["case_sensitive"]=> bool(false) ["charset"]=> string(50) "ABCDEFGHKLMNPRSTUVWYZabcdefghklmnprstuvwyz23456789" ["expiry_time"]=> int(900) ["session_name"]=> NULL ["use_wordlist"]=> bool(false) ["perturbation"]=> float(0.75) ["num_lines"]=> int(8) ["noise_level"]=> int(0) ["i_signature"]=> string(0) "" ["signature_color"]=> object(VerifyIt_Color)#6 (3) { ["r"]=> int(112) ["g"]=> int(112) ["b"]=> int(112) } ["signature_font"]=> string(59) "/mysite/securei/AHGBold.ttf" ["use_sqlite_db"]=> bool(false) ["captcha_type"]=> int(0) ["namespace"]=> string(7) "default" ["ttf_file"]=> string(59) "/mysite/securei/AHGBold.ttf" ["wordlist_file"]=> string(63) "/mysite/securei/words/words.txt" ["background_directory"]=> NULL ["sqlite_database"]=> string(74) "/mysite/securei/database/VerifyIt.sqlite" ["audio_path"]=> string(54) "/mysite/securei/audio/"
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    150
    Rep Power
    3
    And:
    ["audio_noise_path"]=> string(61) "/mysite/securei/audio//noise/" ["audio_use_noise"]=> bool(true) ["audio_mix_normalization"]=> float(0.6) ["degrade_audio"]=> bool(true) ["audio_gap_min"]=> int(0) ["audio_gap_max"]=> int(600) ["imrotected"]=> NULL ["tmpimgrotected"]=> NULL ["bgimgrotected"]=> NULL ["iscalerotected"]=> int(5) ["VerifyIt_pathrotected"]=> string(47) "/mysite/securei" ["coderotected"]=> NULL
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    150
    Rep Power
    3
    lastly:
    ["code_display : protected"]=> NULL ["display_value : protected"]=> NULL ["captcha_code : protected"]=> NULL ["no_exit : protected"]=> bool(false) ["no_session : protected"]=> bool(false) ["send_headers : protected"]=> bool(true) ["sqlite_handle : protected"]=> NULL ["gdbgcolor : protected"]=> NULL ["gdtextcolor : protected"]=> NULL ["gdlinecolor : protected"]=> NULL ["gdsignaturecolor : protected"]=> NULL }
    Note: I figured out what the forum preview was complaining about. Too many smily's. So, in this last section, I put a space in front of and after the colon :
  14. #8
  15. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,866
    Rep Power
    6351
    You can disable smilies with the checkbox below the inputs.

    So you're saying you now have this code:
    PHP Code:
        $verify = new VerifyIt(); 
         
    var_dump($verify);
            if (
    $verify->check($_POST['verify_code']) == false) { 
    And you get a var-dump of the object, and then a "not an object" error?
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    150
    Rep Power
    3
    Thanks for the tip about the smily checkbox!

    And, correct.

    That is my code:
    PHP Code:
     $verify = new VerifyIt();  
         
    var_dump($verify); 
            if (
    $verify->check($_POST['verify_code']) == false) { 
    The var_dump results are posted above, and if I comment out the var_dump line, I'm still getting this error on the third line there:

    Fatal error: Call to a member function check() on a non-object
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    150
    Rep Power
    3

    Thumbs up


    oh geez. found the issue. There was a typo in the word verify in my code. verfy. I must have corrected it here and didn't realize it.

    works now.

    thanks!

    Comments on this post

    • ManiacDan disagrees : Twice we asked you if you were using this exact code.
  20. #11
  21. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,002
    Rep Power
    9398
    Originally Posted by we5inelgr
    There was a typo in the word verify in my code. verfy. I must have corrected it here and didn't realize it.
    Which is why I said
    Originally Posted by requinix
    Is that your exact code? You literally need to copy and paste it here.
  22. #12
  23. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,866
    Rep Power
    6351
    oh geez. found the issue. There was a typo in the word verify in my code.
    The absolute first thing I did when I read your post, the very first thing, was hit ctrl+F and type "verify" and see if your variable names all lit up. We can never, never help you if you post some other code. It's like asking a mechanic to fix your car, and giving him your neighbor's car, then swearing it's yours.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo