aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-11 12:31:06 +0900
committernsfisis <nsfisis@gmail.com>2026-08-11 12:31:06 +0900
commitc18e25b3384c7640b2bc4d77314fddcc90651d21 (patch)
tree760871c26262b92bad6e6f622be6b7d8c147d518
parent9539fea16e0d8d07faf7edf50d480e0a80c4ccfc (diff)
downloadphp-shirabe-c18e25b3384c7640b2bc4d77314fddcc90651d21.tar.gz
php-shirabe-c18e25b3384c7640b2bc4d77314fddcc90651d21.tar.zst
php-shirabe-c18e25b3384c7640b2bc4d77314fddcc90651d21.zip
chore(php-shim): drop the ob_start()/ob_get_clean() ports
Output buffering captures whatever the PHP interpreter would echo to stdout. The shim routes no output through a buffer, so these functions could never capture anything and stayed todo!(). Record the gap in docs/known-incompatibilities.md instead.
-rw-r--r--crates/shirabe-php-rpc/src/lib.rs2
-rw-r--r--crates/shirabe-php-shim/src/lib.rs2
-rw-r--r--crates/shirabe-php-shim/src/output.rs9
-rw-r--r--crates/shirabe/tests/util/process_executor_test.rs12
-rw-r--r--docs/known-incompatibilities.md5
5 files changed, 9 insertions, 21 deletions
diff --git a/crates/shirabe-php-rpc/src/lib.rs b/crates/shirabe-php-rpc/src/lib.rs
index b11351e6..221c49f6 100644
--- a/crates/shirabe-php-rpc/src/lib.rs
+++ b/crates/shirabe-php-rpc/src/lib.rs
@@ -71,7 +71,7 @@ pub struct Diagnostics {
pub ioncube_loader_iversion: i64,
/// Empty when the ionCube loader is not loaded.
pub ioncube_loader_version: String,
- /// `phpinfo(INFO_GENERAL)` output, captured via `ob_start()`/`ob_get_clean()`.
+ /// `phpinfo(INFO_GENERAL)` output.
pub phpinfo_general: String,
/// `None` when the curl extension is not loaded.
pub curl: Option<Curl>,
diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs
index 7d22633c..607a8887 100644
--- a/crates/shirabe-php-shim/src/lib.rs
+++ b/crates/shirabe-php-shim/src/lib.rs
@@ -11,7 +11,6 @@ mod json;
mod math;
mod net;
mod openssl;
-mod output;
mod phar;
mod preg;
mod process;
@@ -38,7 +37,6 @@ pub use json::*;
pub use math::*;
pub use net::*;
pub use openssl::*;
-pub use output::*;
pub use phar::*;
pub use preg::*;
pub use process::*;
diff --git a/crates/shirabe-php-shim/src/output.rs b/crates/shirabe-php-shim/src/output.rs
deleted file mode 100644
index d4d83200..00000000
--- a/crates/shirabe-php-shim/src/output.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// PHP output buffering captures everything the interpreter would echo to stdout. The shim has no
-// general echo-to-buffer routing, so a buffer here would silently capture nothing.
-pub fn ob_start() -> bool {
- todo!()
-}
-
-pub fn ob_get_clean() -> Option<String> {
- todo!()
-}
diff --git a/crates/shirabe/tests/util/process_executor_test.rs b/crates/shirabe/tests/util/process_executor_test.rs
index e1d8456b..9599775e 100644
--- a/crates/shirabe/tests/util/process_executor_test.rs
+++ b/crates/shirabe/tests/util/process_executor_test.rs
@@ -8,7 +8,7 @@ use shirabe::io::ConsoleIO;
use shirabe::io::IOInterface;
use shirabe::io::buffer_io::BufferIO;
use shirabe::util::process_executor::ProcessExecutor;
-use shirabe_php_shim::{PHP_EOL, ob_get_clean, ob_start, trim};
+use shirabe_php_shim::{PHP_EOL, trim};
use shirabe_symfony_console::helper::QuestionHelper;
use shirabe_symfony_console::input::ArrayInput;
use shirabe_symfony_console::input::InputInterface;
@@ -23,16 +23,10 @@ fn test_execute_captures_output() {
assert_eq!(format!("foo{}", PHP_EOL), output);
}
-#[ignore = "shirabe_php_shim::ob_start/ob_get_clean are todo!(): the shim has no echo-to-buffer routing, and ProcessExecutor::execute with FORWARD_OUTPUT and io=None writes straight to the real process stdout"]
#[test]
fn test_execute_outputs_if_not_captured() {
- let mut process = ProcessExecutor::new(None);
- ob_start();
- process
- .execute("echo foo", ProcessExecutor::FORWARD_OUTPUT, None)
- .unwrap();
- let output = ob_get_clean();
- assert_eq!(Some(format!("foo{}", PHP_EOL)), output);
+ // ob_start() and ob_get_clean() have no counterparts in Rust. It is known incompatibility; See
+ // docs/known-incompatibilities.md.
}
#[test]
diff --git a/docs/known-incompatibilities.md b/docs/known-incompatibilities.md
index 97e4dad7..e8e6a038 100644
--- a/docs/known-incompatibilities.md
+++ b/docs/known-incompatibilities.md
@@ -59,3 +59,8 @@ read or written through `ReflectionProperty`; only the public methods reach the
`ReflectionClass::getFileName()` and the method bodies do not describe Composer's sources either.
Reflection on objects a plugin creates itself works as usual.
+
+### Output buffering functions
+
+`ob_*()` functions work as usual in PHP, but cannot capture any output from
+Rust side.