|
11 | 11 |
|
12 | 12 | namespace Composer\XdebugHandler; |
13 | 13 |
|
| 14 | +use Composer\Pcre\Preg; |
14 | 15 | use Psr\Log\LoggerInterface; |
15 | 16 |
|
16 | 17 | /** |
@@ -96,7 +97,7 @@ public function __construct($envPrefix) |
96 | 97 | $this->mode = empty($modes) ? 'off' : implode(',', $modes); |
97 | 98 | } elseif (false !== ($mode = ini_get('xdebug.mode'))) { |
98 | 99 | $this->mode = getenv('XDEBUG_MODE') ?: ($mode ?: 'off'); |
99 | | - if (preg_match('/^,+$/', str_replace(' ', '', $this->mode))) { |
| 100 | + if (Preg::isMatch('/^,+$/', str_replace(' ', '', $this->mode))) { |
100 | 101 | $this->mode = 'off'; |
101 | 102 | } |
102 | 103 | } |
@@ -346,7 +347,7 @@ private function doRestart(array $command) |
346 | 347 | if ($this->debug === '2') { |
347 | 348 | $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni); |
348 | 349 | } else { |
349 | | - @unlink($this->tmpIni); |
| 350 | + @unlink((string) $this->tmpIni); |
350 | 351 | } |
351 | 352 |
|
352 | 353 | exit($exitCode); |
@@ -423,10 +424,10 @@ private function writeTmpIni(array $iniFiles, $tmpDir, &$error) |
423 | 424 | return false; |
424 | 425 | } |
425 | 426 | // Check and remove directives after HOST and PATH sections |
426 | | - if (preg_match($sectionRegex, $data, $matches, PREG_OFFSET_CAPTURE)) { |
| 427 | + if (Preg::isMatchWithOffsets($sectionRegex, $data, $matches, PREG_OFFSET_CAPTURE)) { |
427 | 428 | $data = substr($data, 0, $matches[0][1]); |
428 | 429 | } |
429 | | - $content .= preg_replace($xdebugRegex, ';$1', $data).PHP_EOL; |
| 430 | + $content .= Preg::replace($xdebugRegex, ';$1', $data).PHP_EOL; |
430 | 431 | } |
431 | 432 |
|
432 | 433 | // Merge loaded settings into our ini content, if it is valid |
|
0 commit comments