minor #24960 SCA with Php Inspections (EA Extended) (kalessil)

This PR was squashed before being merged into the 3.4 branch (closes #24960).

Discussion
----------

SCA with Php Inspections (EA Extended)

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

- Greedy regex characters set fixed
- Potential race-conditions fixed

Commits
-------

4d39a2d SCA with Php Inspections (EA Extended)
This commit is contained in:
Nicolas Grekas 2017-12-04 13:09:04 +01:00
commit 2adb67bb42
4 changed files with 4 additions and 4 deletions

View File

@ -423,7 +423,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*/
public function setAnnotatedClassCache(array $annotatedClasses)
{
file_put_contents(($this->warmupDir ?: $this->getCacheDir()).'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true)));
file_put_contents(($this->warmupDir ?: $this->getCacheDir()).'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true)), LOCK_EX);
}
/**

View File

@ -82,7 +82,7 @@ final class Definition
private function addPlace($place)
{
if (!preg_match('{^[\w\d_-]+$}', $place)) {
if (!preg_match('{^[\w_-]+$}', $place)) {
throw new InvalidArgumentException(sprintf('The place "%s" contains invalid characters.', $place));
}

View File

@ -77,7 +77,7 @@ class DefinitionBuilder
*/
public function addPlace($place)
{
if (!preg_match('{^[\w\d_-]+$}', $place)) {
if (!preg_match('{^[\w_-]+$}', $place)) {
throw new InvalidArgumentException(sprintf('The place "%s" contains invalid characters.', $place));
}

View File

@ -30,7 +30,7 @@ class Transition
*/
public function __construct($name, $froms, $tos)
{
if (!preg_match('{^[\w\d_-]+$}', $name)) {
if (!preg_match('{^[\w_-]+$}', $name)) {
throw new InvalidArgumentException(sprintf('The transition "%s" contains invalid characters.', $name));
}