Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pcre2 10.37 broke PHP regex #78635

@rlanting-framna

Description

@rlanting-framna

brew gist-logs <formula> link OR brew config AND brew doctor output

brew config
HOMEBREW_VERSION: 3.1.9-119-gd74da6c
ORIGIN: https://github.com/Homebrew/brew
HEAD: d74da6cfc671bcc22590dde2a7ad81eb444cef18
Last commit: 4 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 261cfb9fa6e3b5b4f1eeb25ee3c8388f14493aa0
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: nano
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit kabylake
Clang: 12.0.5 build 1205
Git: 2.31.1 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.3.1-x86_64
CLT: 12.5.0.22.9
Xcode: N/A
brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  ilmbase

  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

Run the following code:

<?php

$matches = [];
$test = ' App\Domain\Repository\MetaData\SomethingRepositoryInterface';

preg_match('/\\\\([^\\\\]+)\s*$/', $test, $matches);
var_dump($matches);

$test2 = ' App\Domain\Exception\NotFoundException';

preg_match('/\\\\([^\\\\]+)\s*$/', $test2, $matches);
var_dump($matches);

The regex originates from https://github.com/phpspec/phpspec/blob/eb0d939b235f6091a8439a2a2fc144c9e0d5f569/src/PhpSpec/CodeAnalysis/TokenizedNamespaceResolver.php#L119

With the regex not working it breaks phpspec.

What happened (include all command output)?

array(0) {
}
array(2) {
  [0]=>
  string(18) "\NotFoundException"
  [1]=>
  string(17) "NotFoundException"
}

What did you expect to happen?

array(2) {
  [0]=>
  string(29) "\SomethingRepositoryInterface"
  [1]=>
  string(28) "SomethingRepositoryInterface"
}
array(2) {
  [0]=>
  string(18) "\NotFoundException"
  [1]=>
  string(17) "NotFoundException"
}

Step-by-step reproduction instructions (by running brew commands)

- brew install php
- /usr/local/opt/php/bin/php test-code.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedPR was locked due to agestaleNo recent activityupstream issueAn upstream issue report is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions