I have a very strange problem.
When I open the script below in the browser and execute it, everything works as expected. Even if I call the script in the command line, I have the expected result.
But if I run the script in a background job, the script aborts in the "preg_match" function without any error. I don't have an error message for this anywhere, neither in the logs nor anywhere else. I also checked if the function exists and it does.
The script just seems to abort at preg_match and doesn't show any message about possible errors. So i'm getting only the output "CHECKPOINT 1".
I have checked the PHP versions and everywhere the same version (same path). Also the settings of pcre are identical.
Is it possible that I have different modules or functions for preg_match? Is there any way I can check what happens in the function?
with try & catch i don't get any information about the problem.
<?php
class pcre_check
{
public function setUp() {
}
public function perform() {
echo "CHECKPOINT 1";
preg_match("/[0-9]{4}/", "6876 ABCDEFGH", $matches, PREG_OFFSET_CAPTURE);
print_r($matches);
echo "CHECKPOINT 2";
}
public function tearDown() {
}
}
$test = new pcre_check();
$test->setUp();
$test->perform();
$test->tearDown();
?>
Systeminfos:
The same script works online on the production server. Only on my local server I have this problem.
It seems there is an issue with regular expressions. The function preg_replace isn't working too but str_replace with replacement of a normal string is working.
It seems that it is working now. I didn't find the problem, but after the update to macOS Big Sur it seems to work now.