Home
DevCentral
Search
Configure Global Search
Log In
Transactions
T2153
Change Details
Change Details
Old
New
Diff
Follow-up for 026cff14f: ``` [20-Oct-2025 18:57:00 UTC] PHP Fatal error: Uncaught Error: Undefined constant "STDERR" in /var/51-wwwroot/obsidian/workspaces/src/includes/autoload_vendor.php:43 Stack trace: #0 /var/51-wwwroot/obsidian/workspaces/src/includes/autoload_vendor.php(50): require_vendor_autoload() #1 /var/51-wwwroot/obsidian/workspaces/src/includes/core.php(25): require_once('/var/51-wwwroot...') #2 /var/51-wwwroot/obsidian/workspaces/src/index.php(28): include('/var/51-wwwroot...') #3 {main} thrown in /var/51-wwwroot/obsidian/workspaces/src/includes/autoload_vendor.php on line 43 ``` STDERR made sense in a43c38521 to write an error message when running phpunit, as it runs in CLI context. For an hybrid CLI/web context, we can: - use error_log(..."", 0); - open a stderr stream, the easiest being to use the wrapper file_put_contents("php://stderr", "...");
When Composer isn't install, a message is printed to stderr by former bootstrap code used for phpunit to load libraries. When this code has been migrated in 026cff14f to use everywhere, that triggers this error: ``` [20-Oct-2025 18:57:00 UTC] PHP Fatal error: Uncaught Error: Undefined constant "STDERR" in /var/51-wwwroot/obsidian/workspaces/src/includes/autoload_vendor.php:43 Stack trace: #0 /var/51-wwwroot/obsidian/workspaces/src/includes/autoload_vendor.php(50): require_vendor_autoload() #1 /var/51-wwwroot/obsidian/workspaces/src/includes/core.php(25): require_once('/var/51-wwwroot...') #2 /var/51-wwwroot/obsidian/workspaces/src/index.php(28): include('/var/51-wwwroot...') #3 {main} thrown in /var/51-wwwroot/obsidian/workspaces/src/includes/autoload_vendor.php on line 43 ``` To use the constant STDERR made sense in a43c38521 to write an error message when running phpunit, as it runs in CLI context. This constant isn't defined in other SAPI, including the php-fpm one, hence the fatal error. For an hybrid CLI/web context, we can replace fwrite(STDERR, "...") with: - error_log("...", 0); -> but need first to check it outputs to stderr in CLI context - open a stderr stream, the easiest being to use the wrapper file_put_contents("php://stderr", "...");
Follow-up for 026cff14f
When Composer isn't install, a message is printed to stderr by former bootstrap code used for phpunit to load libraries. When this code has been migrated in 026cff14f to use everywhere, that triggers this error
: ``` [20-Oct-2025 18:57:00 UTC] PHP Fatal error: Uncaught Error: Undefined constant "STDERR" in /var/51-wwwroot/obsidian/workspaces/src/includes/autoload_vendor.php:43 Stack trace: #0 /var/51-wwwroot/obsidian/workspaces/src/includes/autoload_vendor.php(50): require_vendor_autoload() #1 /var/51-wwwroot/obsidian/workspaces/src/includes/core.php(25): require_once('/var/51-wwwroot...') #2 /var/51-wwwroot/obsidian/workspaces/src/index.php(28): include('/var/51-wwwroot...') #3 {main} thrown in /var/51-wwwroot/obsidian/workspaces/src/includes/autoload_vendor.php on line 43 ```
To use the constant
STDERR made sense in a43c38521 to write an error message when running phpunit
, as it runs in CLI context. This constant isn't defined in other SAPI, including the php-fpm one
,
as it runs in CLI context
hence the fatal error
. For an hybrid CLI/web context, we can
replace fwrite(STDERR, "...") with
:
- use
-
error_log(
...""
"..."
, 0);
-> but need first to check it outputs to stderr in CLI context
- open a stderr stream, the easiest being to use the wrapper file_put_contents("php://stderr", "...");
Continue