php / php/doc-en

preg_match_all $flags default value is unclear

Open
#1,738 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Extension: pcre
Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

From manual page: https://php.net/function.preg-match-all

Hi, just a small thing, the Description section says that int $flags = 0,, but the Parameters section describing flags says at the end that:

If no order flag is given, PREG_PATTERN_ORDER is assumed.

The numeric value of PREG_PATTERN_ORDER is 1, the source says $flags = 0 at
https://github.com/php/php-src/blob/master/ext/pcre/php_pcre.stub.php#L105

function preg_match_all(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false {}

Maybe they could be made consistent, even lying a bit in the docs by saying $flags = PREG_PATTERN_ORDER?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the preg_match_all manual page's Description and Parameters sections with the referenced ext/pcre/php_pcre.stub.php definition. Decide on wording that clearly explains the default flags behavior, update the documentation, and verify that the signature and parameter description are consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.