I have a project that includes a bootstrap file. It should be included once. This works for most developers, but now on one machine, the file gets included twice, because the paths are slightly different.
Notice the capital letters:
/Users/johndoe/desktop/projects/project_name/bootstrap.php
vs
/Users/johndoe/Desktop/Projects/project_name/bootstrap.php
Without going through the whole project the simplest I can describe it is this:
The root file is build.php:
// build.php
...
dump(__DIR__);
include "includes/content.html";
...
// top of includes/content.php
dump(__DIR__);
...
//Outputs
/Users/johndoe/Desktop/Projects
/Users/johndoe/desktop/projects/includes
I've done quite some years in php, I've never come across this before!
Environment:
- mac + brew
- php 8.1