Professional Web Applications Themes

#22366 [Com]: PREG_OFFSET_CAPTURE produces error with preg_match_all - PHP Development

ID: 22366 Comment by: ewvea3dgc7001 at sneakemail dot com Reported By: csaba at alum dot mit dot edu Status: Bogus Bug Type: PCRE related Operating System: Win 2K PHP Version: 4.3.0 New Comment: This is in status of "Bogus" and it is not bogus. PREG_OFFSET_CAPTURE does *NOT* work with win2k as of the latest 4.3.2 build. Something is goobered with it. Previous Comments: ------------------------------------------------------------------------ [2003-02-23 02:52:13] [email]sniperphp.net[/email] When you use preg_match_all() with only 3 paramaters, then PREG_PATTERN_ORDER is assumed for order flag. ------------------------------------------------------------------------ [2003-02-21 17:01:39] csaba at alum dot mit dot edu The following code gives me an error message ...

  1. #1

    Default #22366 [Com]: PREG_OFFSET_CAPTURE produces error with preg_match_all

    ID: 22366
    Comment by: ewvea3dgc7001 at sneakemail dot com
    Reported By: csaba at alum dot mit dot edu
    Status: Bogus
    Bug Type: PCRE related
    Operating System: Win 2K
    PHP Version: 4.3.0
    New Comment:

    This is in status of "Bogus" and it is not bogus.
    PREG_OFFSET_CAPTURE does *NOT* work with win2k as of the latest 4.3.2
    build. Something is goobered with it.


    Previous Comments:
    ------------------------------------------------------------------------

    [2003-02-23 02:52:13] [email]sniperphp.net[/email]

    When you use preg_match_all() with only 3 paramaters,
    then PREG_PATTERN_ORDER is assumed for order flag.


    ------------------------------------------------------------------------

    [2003-02-21 17:01:39] csaba at alum dot mit dot edu

    The following code gives me an error message of:
    Wrong value for parameter 4 in call to preg_match_all() ...

    if I replace the PREG_OFFSET_CAPTURE with either
    PREG_OFFSET_CAPTURE | PREG_SET_ORDER
    or PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER
    then it works as advertised.
    This contradicts the doentation statement:
    If no order flag is given, PREG_PATTERN_ORDER is assumed

    $page = "<html><head></head><body><form>" .
    "<input onClick='alert(\"Hi Mom\")' " .
    "value='Click me'>" .
    "<input onClick='alert(\"Hi Dad\")' " .
    "value=\"Dad's button\">" .
    "</form></body></html>";

    $regexp = "/<input[^>]*(value=[^>]*)>/";
    if (!preg_match_all($regexp, $page, $mtch,
    PREG_OFFSET_CAPTURE))
    print "<br>Could not match";
    else print "<br>Found matches";

    This is on my PHP 4.3.0 / Apache 2.0.43 / Win 2K Pro system
    Csaba Gabor from New York

    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=22366&edit=1[/url]
    ewvea3dgc7001 at sneakemail dot com Guest

  2. #2

    Default #22366 [Com]: PREG_OFFSET_CAPTURE produces error with preg_match_all

    ID: 22366
    Comment by: ewvea3dgc7001 at sneakemail dot com
    Reported By: csaba at alum dot mit dot edu
    Status: Bogus
    Bug Type: PCRE related
    Operating System: Win 2K
    PHP Version: 4.3.0
    New Comment:

    Take the following code:

    $term_regex='\<td\>\<font face\="verdana,sans-serif"
    size\=1\>&nbsp;(.*?)\</td\>.\<td\>&nbsp;\<a href\="(.*?)"\>\<font
    face\="verdana,sans-serif" size\=1
    color\=#000000\>(.*?)\</a\>\</td\>.\</tr\>';

    preg_match_all("|$term_regex|ms", $snoopy->results, $m,
    PREG_OFFSET_CAPTURE );
    print_r($m);

    ----
    this results in:
    <b>Warning</b>: Wrong value for parameter 4 in call to
    preg_match_all() in <b>c:\local\htdocs\ov_tool\tool.php</b> on line
    <b>26</b><br />

    When changed to either of the other 2 int flags it matches fine. This
    is a valid bug!!

    PHP 4.3.2, Apache 1.3.29, WinXP Pro


    Previous Comments:
    ------------------------------------------------------------------------

    [2003-10-31 00:45:04] ewvea3dgc7001 at sneakemail dot com

    This is in status of "Bogus" and it is not bogus.
    PREG_OFFSET_CAPTURE does *NOT* work with win2k as of the latest 4.3.2
    build. Something is goobered with it.

    ------------------------------------------------------------------------

    [2003-02-23 02:52:13] [email]sniperphp.net[/email]

    When you use preg_match_all() with only 3 paramaters,
    then PREG_PATTERN_ORDER is assumed for order flag.


    ------------------------------------------------------------------------

    [2003-02-21 17:01:39] csaba at alum dot mit dot edu

    The following code gives me an error message of:
    Wrong value for parameter 4 in call to preg_match_all() ...

    if I replace the PREG_OFFSET_CAPTURE with either
    PREG_OFFSET_CAPTURE | PREG_SET_ORDER
    or PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER
    then it works as advertised.
    This contradicts the doentation statement:
    If no order flag is given, PREG_PATTERN_ORDER is assumed

    $page = "<html><head></head><body><form>" .
    "<input onClick='alert(\"Hi Mom\")' " .
    "value='Click me'>" .
    "<input onClick='alert(\"Hi Dad\")' " .
    "value=\"Dad's button\">" .
    "</form></body></html>";

    $regexp = "/<input[^>]*(value=[^>]*)>/";
    if (!preg_match_all($regexp, $page, $mtch,
    PREG_OFFSET_CAPTURE))
    print "<br>Could not match";
    else print "<br>Found matches";

    This is on my PHP 4.3.0 / Apache 2.0.43 / Win 2K Pro system
    Csaba Gabor from New York

    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=22366&edit=1[/url]
    ewvea3dgc7001 at sneakemail dot com Guest

  3. #3

    Default #22366 [Com]: PREG_OFFSET_CAPTURE produces error with preg_match_all

    ID: 22366
    Comment by: eagleprof at yahoo dot com dot au
    Reported By: csaba at alum dot mit dot edu
    Status: Bogus
    Bug Type: PCRE related
    Operating System: Win 2K
    PHP Version: 4.3.0
    New Comment:

    This is not a bogus bug. I can repeat it too. I have a Win2K/IIS 5.0
    setup using PHP v4.3.2.

    As csaba says, the problem occurs when you have four parameters and
    attempt to pass the PREG_OFFSET_CAPTURE flag by itself as the fourth
    parameter. The workaround is to explicitly set the sort order with the
    PREG_OFFSET_CAPTURE flag.


    Previous Comments:
    ------------------------------------------------------------------------

    [2003-02-23 02:52:13] net

    When you use preg_match_all() with only 3 paramaters,
    then PREG_PATTERN_ORDER is assumed for order flag.


    ------------------------------------------------------------------------

    [2003-02-21 17:01:39] csaba at alum dot mit dot edu

    The following code gives me an error message of:
    Wrong value for parameter 4 in call to preg_match_all() ...

    if I replace the PREG_OFFSET_CAPTURE with either
    PREG_OFFSET_CAPTURE | PREG_SET_ORDER
    or PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER
    then it works as advertised.
    This contradicts the doentation statement:
    If no order flag is given, PREG_PATTERN_ORDER is assumed

    $page = "<html><head></head><body><form>" .
    "<input onClick='alert(\"Hi Mom\")' " .
    "value='Click me'>" .
    "<input onClick='alert(\"Hi Dad\")' " .
    "value=\"Dad's button\">" .
    "</form></body></html>";

    $regexp = "/<input[^>]*(value=[^>]*)>/";
    if (!preg_match_all($regexp, $page, $mtch,
    PREG_OFFSET_CAPTURE))
    print "<br>Could not match";
    else print "<br>Found matches";

    This is on my PHP 4.3.0 / Apache 2.0.43 / Win 2K Pro system
    Csaba Gabor from New York

    ------------------------------------------------------------------------


    --
    Edit this bug report at http://bugs.php.net/?id=22366&edit=1
    eagleprof Guest

Similar Threads

  1. #39825 [NEW]: foreach produces memory error
    By krejci at ped dot muni dot cz in forum PHP Bugs
    Replies: 4
    Last Post: December 25th, 07:23 PM
  2. DropDown in .NET DataGrid produces OnDataGridUpdate error
    By Les Matthews in forum Dreamweaver AppDev
    Replies: 4
    Last Post: April 18th, 05:18 PM
  3. #25454 [Csd->Bgs]: ldap_bind produces an assertion error in cyrus.c
    By magnus@php.net in forum PHP Development
    Replies: 0
    Last Post: September 11th, 09:11 AM
  4. #25454 [Opn->Bgs]: ldap_bind produces an assertion error in cyrus.c
    By sniper@php.net in forum PHP Development
    Replies: 0
    Last Post: September 10th, 01:09 PM
  5. if mysql_query() produces an error...
    By Phil Powell in forum PHP Development
    Replies: 0
    Last Post: August 21st, 09:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139