Before: Civi code living under a path containing the characters php
(such as ~/src/php/civicrm) will crash trying to load services with
a message like the following:
ReflectionException: Class Civi\Api4\Service\Spec\Provider\src
does not exist in ReflectionClass->__construct()
After: Civi loads services normally no matter what the enclosing path
$container->addResource($resource);
foreach (glob("$path*.php") as $file) {
$matches = [];
- preg_match('/(\w*).php/', $file, $matches);
+ preg_match('/(\w*)\.php$/', $file, $matches);
$serviceName = $namespace . array_pop($matches);
$serviceClass = new \ReflectionClass($serviceName);
if ($serviceClass->isInstantiable()) {