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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:01:07+00:00 2026-05-31T22:01:07+00:00

1.3 dev version of SimplePie on xampp with PHP 5.3. I am able to

  • 0

1.3 dev version of SimplePie on xampp with PHP 5.3.

I am able to get an RSS feed and display it but I get these errors for every item fetched:

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 562 in C:\xampp\htdocs\simplepie.php on line 5877

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 509 in C:\xampp\htdocs\simplepie.php on line 5965

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 509 in C:\xampp\htdocs\simplepie.php on line 6031

The functions where the errors occur:

    /**
 * Parse RFC2822's date format
 *
 * @access protected
 * @return int Timestamp
 */
public function date_rfc2822($date)
{
    static $pcre;
    if (!$pcre)
    {
        $wsp = '[\x09\x20]';
        $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
        $optional_fws = $fws . '?';
        $day_name = $this->day_pcre;
        $month = $this->month_pcre;
        $day = '([0-9]{1,2})';
        $hour = $minute = $second = '([0-9]{2})';
        $year = '([0-9]{2,4})';
        $num_zone = '([+\-])([0-9]{2})([0-9]{2})';
        $character_zone = '([A-Z]{1,5})';
        $zone = '(?:' . $num_zone . '|' . $character_zone . ')';
        $pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
    }
    if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))

/**
 * Parse RFC850's date format
 *
 * @access protected
 * @return int Timestamp
 */
public function date_rfc850($date)
{
    static $pcre;
    if (!$pcre)
    {
        $space = '[\x09\x20]+';
        $day_name = $this->day_pcre;
        $month = $this->month_pcre;
        $day = '([0-9]{1,2})';
        $year = $hour = $minute = $second = '([0-9]{2})';
        $zone = '([A-Z]{1,5})';
        $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i';
    }
    if (preg_match($pcre, $date, $match))

/**
 * Parse C99's asctime()'s date format
 *
 * @access protected
 * @return int Timestamp
 */
public function date_asctime($date)
{
    static $pcre;
    if (!$pcre)
    {
        $space = '[\x09\x20]+';
        $wday_name = $this->day_pcre;
        $mon_name = $this->month_pcre;
        $day = '([0-9]{1,2})';
        $hour = $sec = $min = '([0-9]{2})';
        $year = '([0-9]{4})';
        $terminator = '\x0A?\x00?';
        $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
    }
    if (preg_match($pcre, $date, $match))

The lines referenced by the error is the last if expression for each function (you can see full code here).

I think there is just bad regex in each $pcre for each function.

Thank you

  • 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-31T22:01:08+00:00Added an answer on May 31, 2026 at 10:01 pm

    If anything is wrong with the regex, it shouldn’t compile.
    However, $this->day_pcre and $this->month_pcre may contain metacharacters that might turn the regex bad. Better check that.

    I substituted ‘Mon’ and ‘Oct’ and ran it on Ideone. Seems to work.

    As a side note, you might want to exchange $fws –

    from $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)'
    to $fws = '(?:(?:(?:\x0D\x0A)?' . $wsp . ')+)'

    as they are equivalent and probably more efficient.

    In your functions, you should print out the regular expressions for
    $day/$month/$pcre variables. How else can you expect to debug it?

    It may be something else, I don’t know.

    Here is what I get: http://ideone.com/zJ5vE

    Code

    <?php
    
    date_asctime( "Mon Oct 21 11:21:31 2012\x0A" );
    date_asctime( "Mon Oct 22 12:22:32 2012\x0A" );
    date_asctime( "Mon Oct 23 13:23:33 2012\x0A" );
    
    print("==================\n");
    
    date_rfc2822( 'Mon, 21 Oct 2012 21:01 -1011' );
    date_rfc2822( 'Mon, 22 Oct 2012 22:02 -1012' );
    date_rfc2822( 'Mon, 23 Oct 2012 23:03 -1013' );
    
    
    /**
     * Parse C99's asctime()'s date format
     *
     * @access protected
     * @return int Timestamp
     */
    function date_asctime($date)
    {
        static $pcre;
        if (!$pcre)
        {
            $space = '[\x09\x20]+';
    
            $wday_name = 'Mon';  //$this->day_pcre;
            $mon_name = 'Oct';   //$this->month_pcre;
    
            $day = '([0-9]{1,2})';
            $hour = $sec = $min = '([0-9]{2})';
            $year = '([0-9]{4})';
            $terminator = '\x0A?\x00?';
            $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
        }
        if (preg_match($pcre, $date, $match))
        {
           print_r($match);
        }
    }
    
    
    /**
     * Parse RFC2822's date format
     *
     * @access protected
     * @return int Timestamp
     */
    function date_rfc2822($date)
    {
        static $pcre;
        if (!$pcre)
        {
            $wsp = '[\x09\x20]';
    
             // $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
            $fws = '(?:(?:(?:\x0D\x0A)?' . $wsp . ')+)';
            $optional_fws = $fws . '?';
    
            $day_name = 'Mon';  //$this->day_pcre;
            $month = 'Oct';     //$this->month_pcre;
    
            $day = '([0-9]{1,2})';
            $hour = $minute = $second = '([0-9]{2})';
            $year = '([0-9]{2,4})';
            $num_zone = '([+\-])([0-9]{2})([0-9]{2})';
            $character_zone = '([A-Z]{1,5})';
            $zone = '(?:' . $num_zone . '|' . $character_zone . ')';
            $pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
        }
        // if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
        if (preg_match($pcre, $date, $match))
        {
           print_r($match);
        }
    } 
    ?>
    

    Output

    Array
    (
        [0] => Mon Oct 21 11:21:31 2012
    
        [1] => 21
        [2] => 11
        [3] => 21
        [4] => 31
        [5] => 2012
    )
    Array
    (
        [0] => Mon Oct 22 12:22:32 2012
    
        [1] => 22
        [2] => 12
        [3] => 22
        [4] => 32
        [5] => 2012
    )
    Array
    (
        [0] => Mon Oct 23 13:23:33 2012
    
        [1] => 23
        [2] => 13
        [3] => 23
        [4] => 33
        [5] => 2012
    )
    ==================
    Array
    (
        [0] => Mon, 21 Oct 2012 21:01 -1011
        [1] => 21
        [2] => 2012
        [3] => 21
        [4] => 01
        [5] => 
        [6] => -
        [7] => 10
        [8] => 11
    )
    Array
    (
        [0] => Mon, 22 Oct 2012 22:02 -1012
        [1] => 22
        [2] => 2012
        [3] => 22
        [4] => 02
        [5] => 
        [6] => -
        [7] => 10
        [8] => 12
    )
    Array
    (
        [0] => Mon, 23 Oct 2012 23:03 -1013
        [1] => 23
        [2] => 2012
        [3] => 23
        [4] => 03
        [5] => 
        [6] => -
        [7] => 10
        [8] => 13
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to rebuild someone's old C++ project using Dev-C++ (version 4.9.9.2) and the
Our dev server was recently upgraded to PHP v5.2.13. With that upgrade we have
I'm the second dev and a recent hire here at a PHP/MySQL shop. I
I have a dev, that will get around our code coverage by writing tests
I've been using a pre 1.0 version of django (a dev version somewhere around
The dev version of Netbeans has Git support. This is great. I'm not sure
Today i discovered that my dev version of my website do not execute success
I've implemented Scott Hanselman's method for keeping up with a dev/qa/prod version of web.config:
I am messing around with a test database for the dev version of my
Please, observe: PS Z:\dev> hg version Mercurial Distributed SCM (version 1.9.2) (see http://mercurial.selenic.com for

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.