Skip to content

Instantly share code, notes, and snippets.

@erickmajor
Created April 30, 2020 16:59
Show Gist options
  • Save erickmajor/d68924b3f38001386658abbfb09ef255 to your computer and use it in GitHub Desktop.
Save erickmajor/d68924b3f38001386658abbfb09ef255 to your computer and use it in GitHub Desktop.
Bug fix for baseUri in Phalcon 4 version
<?php
/**
* @todo Bug fix for baseUri in Phalcon 4 version
* @see {@link https://github.com/phalcon/cphalcon/issues/14559 [BUG]: v4 Regression - localhost/project/ - trouble with Application->handle}
*/
if ('/' !== $config->application->baseUri) {
$tree = explode(DIRECTORY_SEPARATOR, BASE_PATH);
$projectDirectory = end($tree);
return $application->handle(str_replace("/{$projectDirectory}/",'', $_SERVER['REQUEST_URI']))->getContent();
} else {
return $application->handle($_SERVER['REQUEST_URI'])->getContent();
}
<?php
echo require 'baseuri.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment