ID:               45909
 Updated by:       [EMAIL PROTECTED]
 Reported By:      wrzasq at gmail dot com
-Status:           No Feedback
+Status:           Closed
 Bug Type:         PCRE related
 Operating System: Debian GNU/Linux 2.6.24 x86_64
 PHP Version:      5.2.6
 New Comment:

The information about arguments of each PCRE functions, and other
extensions were improved in PHP 5.3.


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

[2008-09-02 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

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

[2008-08-25 18:14:34] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.3-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.3-win32-installer-latest.msi



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

[2008-08-25 16:38:27] wrzasq at gmail dot com

Description:
------------
Before I look into manual I often just check parameters list for 
functions/methods from command line which usualy is enought for me.

Today I wanted to check preg_replace() parameters list to see which 
of them is $limit, but unfortunately PHP seems to not export 
parameters names for preg_replace() (as well as for other PCRE 
functions - checked preg_match() also, didn't have time for more). 
Parameters are all named $paramX (where X is number in order).

Additionaly they are all marked as required even if they are not.

Reproduce code:
---------------
php --rf preg_replace
php --rf preg_match
php -r '$f = new ReflectionFunction("preg_replace");
print_r($f->getParameters());'

Expected result:
----------------
Function [ <internal:pcre> function preg_replace ] {

  - Parameters [5] {
    Parameter #0 [ <required> $pattern ]
    Parameter #1 [ <required> $replacement ]
    Parameter #2 [ <required> $subject ]
    Parameter #3 [ <optional> $limit ]
    Parameter #4 [ <optional> &$count ]
  }
}

Function [ <internal:pcre> function preg_match ] {

  - Parameters [3] {
    Parameter #0 [ <required> $pattern ]
    Parameter #1 [ <required> $subject ]
    Parameter #2 [ <optional> &$matches ]
  }
}

Array
(
    [0] => ReflectionParameter Object
        (
            [name] => pattern
        )

    [1] => ReflectionParameter Object
        (
            [name] => replacement
        )

    [2] => ReflectionParameter Object
        (
            [name] => subject
        )

    [3] => ReflectionParameter Object
        (
            [name] => limit
        )

    [4] => ReflectionParameter Object
        (
            [name] => count
        )

)


Actual result:
--------------
Function [ <internal:pcre> function preg_replace ] {

  - Parameters [5] {
    Parameter #0 [ <required> $param0 ]
    Parameter #1 [ <required> $param1 ]
    Parameter #2 [ <required> $param2 ]
    Parameter #3 [ <required> $param3 ]
    Parameter #4 [ <required> &$param4 ]
  }
}

Function [ <internal:pcre> function preg_match ] {

  - Parameters [3] {
    Parameter #0 [ <required> $param0 ]
    Parameter #1 [ <required> $param1 ]
    Parameter #2 [ <required> &$param2 ]
  }
}

Array
(
    [0] => ReflectionParameter Object
        (
            [name] =>
        )

    [1] => ReflectionParameter Object
        (
            [name] =>
        )

    [2] => ReflectionParameter Object
        (
            [name] =>
        )

    [3] => ReflectionParameter Object
        (
            [name] =>
        )

    [4] => ReflectionParameter Object
        (
            [name] =>
        )

)



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


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

Reply via email to