Thread: mktime() error

    #1
  1. No Profile Picture
    Super Moderator
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,464
    Rep Power
    70

    mktime() error


    Can anyone see an issue in my line?

    Error:
    Code:
    Fatal error: in D:\htdocs\triple_nothing\hellzoneinc.com\projects\bills\inc\functions.inc on line 123
    Line 123 is the 3rd line: (Tried w/ and w/o leading zero for $m)
    PHP Code:
    $m date('n'strtotime($inv[1]));        
    $y date('Y'strtotime($inv[1]));        
    $d = date('t'mktime(000$m1$y)); 
    Edit: During initial round, I echo'ed the $m and $y, so confirmed line 123 is defining as:
    PHP Code:
    $d = date('t'mktime(000412017)); 
    Last edited by Triple_Nothing; July 25th, 2017 at 09:27 AM.
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,333
    Rep Power
    9645
    Originally Posted by Triple_Nothing
    Code:
    Fatal error: in D:\htdocs\triple_nothing\hellzoneinc.com\projects\bills\inc\functions.inc on line 123
    That's all? No message with it?
  4. #3
  5. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,079
    Rep Power
    4101
    Seems fine to me. If you're sure that is the right code block for the error, try deleting the lines and re-typing them, maybe you have some sort of invisible character that is triggering the error.
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  6. #4
  7. No Profile Picture
    Super Moderator
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,464
    Rep Power
    70
    @requinix: Yep. No definition to the error.

    @kicken: I've re-typed the line to double-check the hidden characters. N to test if that was truly the line 123 it referenced, I through a random echo in its place instead, n no more error... :-S

    Edit: The first 2 lines did that as well when I used mktime() before I switched them to strtotime()...
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2016
    Posts
    92
    Rep Power
    5
    Does the 'view source' of the page show more php errors messages?
  10. #6
  11. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,333
    Rep Power
    9645
    There should always be a message, so if there isn't then that's a bug.

    What about
    PHP Code:
    register_shutdown_function(function() {
        if (
    error_get_last()) {
            
    print_r(error_get_last());
            
    print_r(debug_backtrace());
        }
    }); 
  12. #7
  13. No Profile Picture
    Super Moderator
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,464
    Rep Power
    70
    'View Source' or 'Inspect Element' show nothing more.

    The register_shutdown_function() displays:
    Code:
    Array ( [type] => 1 [message] => Uncaught Error: Call to undefined function �date() in D:\htdocs\triple_nothing\hellzoneinc.com\projects\bills\inc\functions.inc:135 Stack trace: #0 D:\htdocs\triple_nothing\hellzoneinc.com\projects\bills\index.php(5): create_new_month() #1 {main} thrown [file] => D:\htdocs\triple_nothing\hellzoneinc.com\projects\bills\inc\functions.inc [line] => 135 ) Array ( [0] => Array ( [function] => runme [args] => Array ( ) ) )
    (Line 135 is the line 123 referenced earlier.)

    Odd. I've retyped this line a few different times. 1 to rule out the misc/hidden characters, n a few to try different methods. My re-type of '= date(' fixed it this time. Bleh. Thanks for the suggestion, requinix.

    That which we cannot see always seems to matter the most. :-/
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  14. #8
  15. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,333
    Rep Power
    9645
    Ah ha. I don't remember the details but there is a particular bug in PHP when it comes to dealing with "invalid" characters in error messages. You might be a victim of that.

    [edit] Tried reproducing with PHP 7.1 from the CLI but couldn't get it.
    Last edited by requinix; July 25th, 2017 at 05:18 PM.

IMN logo majestic logo threadwatch logo seochat tools logo