Skip to content
Open
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"illuminate/reflection": "^13",
"illuminate/session": "^13",
"illuminate/support": "^13",
"illuminate/view": "^13",
"ircmaxell/password-compat": "~1.0",
"laravel/serializable-closure": "^2.0.10",
"monolog/monolog": "^3.10",
Expand Down Expand Up @@ -69,7 +70,6 @@
"illuminate/routing": "self.version",
"illuminate/translation": "self.version",
"illuminate/validation": "self.version",
"illuminate/view": "self.version",
"illuminate/workbench": "self.version"
},
"require-dev": {
Expand Down
54 changes: 54 additions & 0 deletions src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ class Application extends Container implements HttpKernelInterface, TerminableIn
*/
protected $finishCallbacks = array();

/**
* ponytail: v13 terminating-callback shim (v13 ServiceProviders register
* these; fork Foundation predates the API). Remove at task 4.5 foundation swap.
*
* @var array
*/
protected $terminatingCallbacks = array();

/**
* The array of shutdown callbacks.
*
Expand Down Expand Up @@ -139,6 +147,11 @@ protected function registerBaseBindings($request)
$this->instance('request', $request);

$this->instance('Illuminate\Container\Container', $this);

// v13 code resolves the container via the static Container::getInstance()
// (e.g. BladeCompiler::anonymousComponentPath); register the app as the
// global instance so those calls hit the real bindings/aliases (task 4.3).
static::setInstance($this);
}

/**
Expand Down Expand Up @@ -635,6 +648,32 @@ public function finish($callback)
$this->finishCallbacks[] = $callback;
}

/**
* ponytail: v13 Foundation exposes getNamespace() (root PSR-4 namespace) which
* v13's ComponentTagCompiler calls to locate CLASS components. The app uses only
* anonymous components, so the value is never matched — return a benign default
* instead of parsing composer.json. Remove at task 4.5 foundation swap.
*
* @return string
*/
public function getNamespace()
{
return 'App\\';
}

/**
* Register a terminating callback (v13 API; see $terminatingCallbacks).
*
* @param callable $callback
* @return $this
*/
public function terminating(callable $callback)
{
$this->terminatingCallbacks[] = $callback;

return $this;
}

/**
* Register a "shutdown" callback.
*
Expand Down Expand Up @@ -900,6 +939,11 @@ public function terminate(SymfonyRequest $request, SymfonyResponse $response): v
{
$this->callFinishCallbacks($request, $response);

foreach ($this->terminatingCallbacks as $terminating)
{
$this->call($terminating);
}

$this->shutdown();
}

Expand Down Expand Up @@ -1270,6 +1314,16 @@ public function registerCoreContainerAliases()
$this->alias('config', 'Illuminate\Contracts\Config\Repository');
$this->alias('db', 'Illuminate\Database\ConnectionResolverInterface');

// L13 view swap (task 4.3): v13 view internals (component rendering) resolve
// the Factory contract; alias it to the 'view' binding.
$this->alias('view', 'Illuminate\Contracts\View\Factory');

// v13 component rendering autowires the Application/Container contracts;
// mirror v13's 'app' alias cluster (task 4.3).
$this->alias('app', 'Illuminate\Contracts\Foundation\Application');
$this->alias('app', 'Illuminate\Contracts\Container\Container');
$this->alias('app', 'Psr\Container\ContainerInterface');

// ponytail: v13's Support\Facades\Artisan resolves Illuminate\Contracts\Console\Kernel.
// The fork has no console Kernel (task 4.2); 'artisan' is a lazy singleton
// (ArtisanServiceProvider), so alias the contract to it globally — works for the
Expand Down
6 changes: 4 additions & 2 deletions src/Illuminate/Foundation/Console/OptimizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ protected function compileViews()
{
foreach ($this->laravel['files']->allFiles($path) as $file)
{
$viewPath = $file->getRealPath();

try
{
$engine = $this->laravel['view']->getEngineFromPath($file);
$engine = $this->laravel['view']->getEngineFromPath($viewPath);
}
catch (\InvalidArgumentException $e)
{
Expand All @@ -101,7 +103,7 @@ protected function compileViews()

if ($engine instanceof CompilerEngine)
{
$engine->getCompiler()->compile($file);
$engine->getCompiler()->compile($viewPath);
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions src/Illuminate/Foundation/Testing/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,30 @@ protected function filterRequest(DomRequest $request): \Symfony\Component\HttpFo
return $httpRequest;
}

/**
* v13 Request::convertUploadedFiles() re-wraps each file via UploadedFile::createFromBase()
* with test=false, so a plain Symfony upload fails isValid()/mimes under tests. Handing back
* Illuminate\Http\UploadedFile instances lets that instanceof check preserve the test flag.
*/
#[\Override]
protected function filterFiles(array $files): array
{
return $this->toTestUploadedFiles(parent::filterFiles($files));
}

private function toTestUploadedFiles(array $files): array
{
foreach ($files as $key => $file) {
if (is_array($file)) {
$files[$key] = $this->toTestUploadedFiles($file);
} elseif ($file instanceof \Symfony\Component\HttpFoundation\File\UploadedFile) {
$files[$key] = \Illuminate\Http\UploadedFile::createFromBase($file, true);
}
}

return $files;
}

/**
* Get the request parameters from a BrowserKit request.
*
Expand Down
Loading
Loading