Need some PHP help... Thanks :)

Discussion in 'PHP' started by iHolyElement, Jul 17, 2009.

  1. #1
    Im not sure if this goes here or the help section but i posted it here because its about PHP, I need some help fixing some problems with my Blog, Heres a few i get:

    1. Strict Notice: gmmktime() [function.gmmktime]: You should be using the time() function instead in system/plugins/twitter/twitter.plugin.php line 319

    2. on Warning: DateTime::__construct() [datetime.--construct]: Failed to parse time string (Friday, July 17th, 2009|at 6:53am) at position 23 (|): Unexpected character in system/classes/habaridatetime.php line 123

    Notice: Trying to get property of non-object in system/admin/comments_items.php line 17

    Warning: DateTime::__construct() [datetime.--construct]: Failed to parse time string (Friday, July 17th, 2009|at 6:53am) at position 23 (|): Unexpected character in system/classes/habaridatetime.php line 123

    Notice: Trying to get property of non-object in system/admin/comments_items.php line 17

    http://iholyelement.org/blog/admin/comments?status=0" class="edit-date" title="

    Warning: DateTime::__construct() [datetime.--construct]: Failed to parse time string (Friday, July 17th, 2009|at 6:53am) at position 23 (|): Unexpected character in system/classes/habaridatetime.php line 123


    Fatal error: Call to a member function format() on a non-object in /homepages/18/d175004659/htdocs/hosting/exile/live/iholyelement/live/blog/system/admin/comments_items.php on line 17

    3. And just some ones like that...


    If you want to be more help could some PHP guru add me on MSN? iHolyElement@live.com < add it xD


    Thanks!
     
    iHolyElement, Jul 17, 2009 IP
  2. ks.alam28

    ks.alam28 Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    without seeing those php files, i cant say anything.
     
    ks.alam28, Jul 17, 2009 IP
  3. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Okay, Add me on msn:
     
    iHolyElement, Jul 17, 2009 IP
  4. elitasson

    elitasson Member

    Messages:
    49
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #4
    or post the code here?
     
    elitasson, Jul 17, 2009 IP
  5. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Takes to long :D
     
    iHolyElement, Jul 17, 2009 IP
  6. JefK

    JefK Member

    Messages:
    66
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #6
    It happens when an invalid parameter or string is passed to time() or gmmktime() functions. See php.net to see what are the invalid format to pass to those time functions.
    something like $a = time("blah"); of course generates "Failed to parse time string" error.
     
    JefK, Jul 18, 2009 IP
  7. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thats what went wrong with the Twitter one, I change gmmktime() to time() and it worked, Where can i change it for
     
    iHolyElement, Jul 18, 2009 IP
  8. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    This is in habaridatetime.php line 123:

    $datetime = new HabariDateTime($time);
     
    iHolyElement, Jul 18, 2009 IP
  9. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    This is in comments_items.php line 17:

    <span class="date pct15"><span class="dim"><?php _e('on'); ?></span> <a href="<?php URL::eek:ut('admin', array('page' => 'comments', 'status' => $comment->status, 'year' => $comment->date->year, 'month' => $comment->date->mon )); ?>" class="edit-date" title="<?php _e('Search for other comments from '. $comment->date->format('M, Y')) ?>"><?php $comment->date->out('M d, Y');?></a></span>
     
    iHolyElement, Jul 18, 2009 IP
  10. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    No help? ):
     
    iHolyElement, Jul 18, 2009 IP
  11. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    ARG, no help then. ill go somewhere else.
     
    iHolyElement, Jul 18, 2009 IP
  12. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #12
    For the line123, it seems you are sending invalid data which cannot be accpeted to create a new habaridatetime. You need to change $time to equal a valid string which can be accepted.

    At the moment it would seem that $time = "Friday, July 17th, 2009|at 6:53am"; but you need to change this to a valid String for use in the conversion (It seems the | character in particular is not accepted), but seeing as I don't know what the HabariDateTime constructor is expecting i can't tell you exactly what format the String needs to be in.

    As for the line17 i'm not too sure, but to try and debug it, remove this from the line17:
    title="<?php _e('Search for other comments from '. $comment->date->format('M, Y')) ?>"
    Code (markup):
    and see if the error is still appearing. So you can narrow down the problem to a specific piece of code.
     
    wd_2k6, Jul 19, 2009 IP
  13. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Okay ill try.
     
    iHolyElement, Jul 19, 2009 IP
  14. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Nope, didnt work.
     
    iHolyElement, Jul 19, 2009 IP
  15. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    This problem has not yet been fixed, So some support will be good >:)
     
    iHolyElement, Jul 20, 2009 IP
  16. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I found out whats causing the problem.

    I need to delete the | to something else like - or simply nothing, I need some help finding it though, I cant find it! Heres whats on habaridattime.php line 123

    HELP! Thanks.
     
    iHolyElement, Jul 22, 2009 IP
  17. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Did you read my post, I told you that the $time you are sending to this function is causing this problem.
    Now I don't know what date/time format the function HabariDateTime is expecting but you need to modify $time before you send it to the function.

    So basically you need to find the function HabariDateTime (unless its a PHP function) and find out what date/time format it is expecting, then before line 123 you need to modify $time to equal what it is expecting.

    I'd take a guess at that you'd need to delete everything after and including the | character.
    To do this immediatly before line123 add:
    
    $pos = strpos($time, "|");
    $pos -= 1;
    $time = substr_replace($time, "", $pos);
    
    PHP:
     
    wd_2k6, Jul 22, 2009 IP
  18. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    That happens when i put your code in, And im not sure where the HabariDateTime function is. ):
     
    iHolyElement, Jul 22, 2009 IP
  19. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #19
    How about:

    
    $pos = strpos($time, "|");
    echo "<h1>The position is: $pos</h1>";
    $time = substr_replace($time, "test", $pos);
    
    PHP:
    I know this will not work just interested in the error it gives
     
    wd_2k6, Jul 22, 2009 IP
  20. iHolyElement

    iHolyElement Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    It says -.-

     
    iHolyElement, Jul 22, 2009 IP