Commit b3fac4a0 authored by catch's avatar catch
Browse files

Issue #3328454 by xjm, Bhanu951, jidrone, smustgrave: Replace most strpos()...

Issue #3328454 by xjm, Bhanu951, jidrone, smustgrave: Replace most strpos() !== FALSE or === FALSE with str_contains()
parent e029e6cd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@
// Work around the PHP bug.
$path = $url['path'];
$script = 'index.php';
if (strpos($path, '.php') !== FALSE) {
if (str_contains($path, '.php')) {
  // Work backwards through the path to check if a script exists. Otherwise
  // fallback to index.php.
  do {
+2 −2
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ protected function getPackage(IOInterface $io, string $original_json): array {
      }
      // The package wasn't in the lock file, which means we need to tell the
      // user. But there are some packages we want to exclude from this list.
      elseif ($package_name !== 'php' && (strpos($package_name, 'drupal/core-') === FALSE)) {
      elseif ($package_name !== 'php' && !str_contains($package_name, 'drupal/core-')) {
        $not_in_core[$package_name] = $package_name;
      }

@@ -174,7 +174,7 @@ protected function getPackage(IOInterface $io, string $original_json): array {

      // Reconcile dependencies on other Drupal components, so we can set the
      // constraint to our current version.
      if (strpos($package_name, 'drupal/core-') !== FALSE) {
      if (str_contains($package_name, 'drupal/core-')) {
        if ($stability === 'stable') {
          // Set the constraint to ^maj.min.
          $package_data['require'][$package_name] = SemanticVersion::majorMinorConstraint(\Drupal::VERSION);
+1 −1
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ protected function existingFileHasData($contents, $data_path) {
    }
    $data = file_get_contents($data_path->fullPath());

    return strpos($contents, $data) !== FALSE;
    return str_contains($contents, $data);
  }

}
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@
// Work around the PHP bug.
$path = $url['path'];
$script = 'index.php';
if (strpos($path, '.php') !== FALSE) {
if (str_contains($path, '.php')) {
  // Work backwards through the path to check if a script exists. Otherwise
  // fallback to index.php.
  do {
+1 −1
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ function install_begin_request($class_loader, &$install_state) {
  // running tests. However, for security reasons, it is imperative that no
  // installation be permitted using such a prefix.
  $user_agent = $request->cookies->get('SIMPLETEST_USER_AGENT') ?: $request->server->get('HTTP_USER_AGENT');
  if ($install_state['interactive'] && strpos($user_agent, 'simpletest') !== FALSE && !drupal_valid_test_ua()) {
  if ($install_state['interactive'] && str_contains($user_agent, 'simpletest') && !drupal_valid_test_ua()) {
    header($request->server->get('SERVER_PROTOCOL') . ' 403 Forbidden');
    exit;
  }
Loading