Skip to content

Commit 9f00851

Browse files
authored
Merge pull request #233 from stellarwp/feature/uopz-warning
Prevent running slic if the `uopz` extension is enabled with `uopz.exit=0`
2 parents a2ee03c + 627e984 commit 9f00851

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# [2.1.6] - 2025-12-03
8+
- Added - Prevent running slic if the `uopz` extension is enabled with `uopz.exit=0`.
9+
710
# [2.1.5] - 2025-11-28
811

912
- Fixed - Handling of the project in the `use` command to guarantee that project specific override files will apply to all operations performed during the handling of the `use` command, including possible spin up of the stack.

slic.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
<?php
2+
3+
// Load the color functions.
4+
require_once __DIR__ . '/src/utils.php';
5+
6+
// Detect if uopz extension is intercepting exit() calls, which breaks command execution flow.
7+
if ( extension_loaded( 'uopz' ) && ! ini_get( 'uopz.exit' ) ) {
8+
echo \StellarWP\Slic\red( 'Error: The uopz extension is preventing exit() from working.' . PHP_EOL );
9+
echo \StellarWP\Slic\red( 'Set uopz.exit=1 in your php.ini or run: php -d uopz.exit=1 slic' . PHP_EOL );
10+
echo \StellarWP\Slic\red( 'See: https://www.php.net/manual/en/uopz.configuration.php#ini.uopz.exit' . PHP_EOL );
11+
12+
// Re-enable exit for this process, then terminate.
13+
if ( PHP_VERSION_ID < 80400 ) {
14+
uopz_allow_exit( true );
15+
} else {
16+
uopz_unset_return( 'exit' );
17+
uopz_unset_return( 'die' );
18+
}
19+
20+
exit( 1 );
21+
}
22+
223
// Requires the function files we might need.
324
require_once __DIR__ . '/includes/polyfills.php';
425
require_once __DIR__ . '/src/classes/Cache.php';
526
require_once __DIR__ . '/src/cache.php';
6-
require_once __DIR__ . '/src/utils.php';
727
require_once __DIR__ . '/src/scaffold.php';
828
require_once __DIR__ . '/src/slic.php';
929
require_once __DIR__ . '/src/docker.php';
@@ -34,7 +54,7 @@
3454
] );
3555

3656
$cli_name = 'slic';
37-
const CLI_VERSION = '2.1.5';
57+
const CLI_VERSION = '2.1.6';
3858

3959
// If the run-time option `-q`, for "quiet", is specified, then do not print the header.
4060
if ( in_array( '-q', $argv, true ) || ( in_array( 'exec', $argv, true ) && ! in_array( 'help', $argv, true ) ) ) {

0 commit comments

Comments
 (0)