Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractBrowser.php

function AbstractBrowser::doRequestInProcess

Makes a request in another process.

@psalm-param TRequest $request

@psalm-return TResponse

Return value

object

Throws

\RuntimeException When processing returns exit code

1 call to AbstractBrowser::doRequestInProcess()
AbstractBrowser::request in vendor/symfony/browser-kit/AbstractBrowser.php
Calls a URI.

File

vendor/symfony/browser-kit/AbstractBrowser.php, line 422

Class

AbstractBrowser
Simulates a browser.

Namespace

Symfony\Component\BrowserKit

Code

protected function doRequestInProcess(object $request) {
    $deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec');
    putenv('SYMFONY_DEPRECATIONS_SERIALIZE=' . $deprecationsFile);
    $_ENV['SYMFONY_DEPRECATIONS_SERIALIZE'] = $deprecationsFile;
    $process = new PhpProcess($this->getScript($request), null, null);
    $process->run();
    if (file_exists($deprecationsFile)) {
        $deprecations = file_get_contents($deprecationsFile);
        unlink($deprecationsFile);
        foreach ($deprecations ? unserialize($deprecations) : [] as $deprecation) {
            if ($deprecation[0]) {
                // unsilenced on purpose
                trigger_error($deprecation[1], \E_USER_DEPRECATED);
            }
            else {
                @trigger_error($deprecation[1], \E_USER_DEPRECATED);
            }
        }
    }
    if (!$process->isSuccessful() || !preg_match('/^O\\:\\d+\\:/', $process->getOutput())) {
        throw new RuntimeException(\sprintf('OUTPUT: %s ERROR OUTPUT: %s.', $process->getOutput(), $process->getErrorOutput()));
    }
    return unserialize($process->getOutput());
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal