diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-12 00:19:10 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-12 00:19:36 +0900 |
| commit | 561924db750cbb4e4c183f9616472ed9a5b0fc7f (patch) | |
| tree | 13d27f8c4d3a0fca8cfd447ea32befa9aa358228 /crates/shirabe-php-shim/src | |
| parent | daa1acf091627f4f1af63ad44eee988048fa4136 (diff) | |
| download | php-shirabe-561924db750cbb4e4c183f9616472ed9a5b0fc7f.tar.gz php-shirabe-561924db750cbb4e4c183f9616472ed9a5b0fc7f.tar.zst php-shirabe-561924db750cbb4e4c183f9616472ed9a5b0fc7f.zip | |
docs(todo): retag TODO markers by root cause
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim/src')
| -rw-r--r-- | crates/shirabe-php-shim/src/array.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/datetime.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/env.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/exception.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/filter.rs | 10 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/fs.rs | 18 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/json.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/lib.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/net.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/phar.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/preg.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/process.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/runtime.rs | 14 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/stream.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/string.rs | 8 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/url.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe-php-shim/src/var.rs | 4 |
17 files changed, 43 insertions, 43 deletions
diff --git a/crates/shirabe-php-shim/src/array.rs b/crates/shirabe-php-shim/src/array.rs index 00e44da3..3870d59e 100644 --- a/crates/shirabe-php-shim/src/array.rs +++ b/crates/shirabe-php-shim/src/array.rs @@ -687,7 +687,7 @@ pub fn ksort<V>(array: &mut IndexMap<String, V>) { // PHP's default SORT_REGULAR comparison for array keys: two integer-like keys // compare numerically, otherwise byte-wise as strings. -// TODO(phase-c): full SORT_REGULAR semantics for mixed integer/non-numeric-string +// TODO(php-semantics): full SORT_REGULAR semantics for mixed integer/non-numeric-string // keys are not reproduced; every current caller uses homogeneous string keys. fn php_sort_regular_key(a: &str, b: &str) -> std::cmp::Ordering { if let (Ok(na), Ok(nb)) = (a.parse::<i64>(), b.parse::<i64>()) diff --git a/crates/shirabe-php-shim/src/datetime.rs b/crates/shirabe-php-shim/src/datetime.rs index 6bab4afb..fd0348ff 100644 --- a/crates/shirabe-php-shim/src/datetime.rs +++ b/crates/shirabe-php-shim/src/datetime.rs @@ -142,7 +142,7 @@ pub fn date_default_timezone_set(tz: &str) -> bool { pub fn date(format: &str, timestamp: Option<i64>) -> String { let timestamp = timestamp.unwrap_or_else(time); - // TODO(phase-c): model the system default timezone. PHP `date()` renders in the default + // TODO(php-semantics): model the system default timezone. PHP `date()` renders in the default // timezone (usually the system's local zone); without a timezone database only "UTC" can be // resolved here, so on a non-UTC machine this diverges whenever the local date differs from // the UTC date (e.g. daily 00:00-09:00 JST). Fixing this needs a timezone database (a new diff --git a/crates/shirabe-php-shim/src/env.rs b/crates/shirabe-php-shim/src/env.rs index d84a8ad9..8facfb4a 100644 --- a/crates/shirabe-php-shim/src/env.rs +++ b/crates/shirabe-php-shim/src/env.rs @@ -14,7 +14,7 @@ pub fn getenv<K: AsRef<std::ffi::OsStr>>(key: K) -> Option<std::ffi::OsString> { /// thread is concurrently reading or writing the process environment for the /// duration of this call. pub unsafe fn putenv<K: AsRef<std::ffi::OsStr>, V: AsRef<std::ffi::OsStr>>(key: K, value: V) { - // TODO(phase-c): validate key and value format to avoid panic? + // TODO(php-semantics): validate key and value format to avoid panic? unsafe { std::env::set_var(key, value) } } @@ -24,7 +24,7 @@ pub unsafe fn putenv<K: AsRef<std::ffi::OsStr>, V: AsRef<std::ffi::OsStr>>(key: /// thread is concurrently reading or writing the process environment for the /// duration of this call. pub unsafe fn putenv_clear<K: AsRef<std::ffi::OsStr>>(key: K) { - // TODO(phase-c): validate key and value format to avoid panic? + // TODO(php-semantics): validate key and value format to avoid panic? unsafe { std::env::remove_var(key) } } diff --git a/crates/shirabe-php-shim/src/exception.rs b/crates/shirabe-php-shim/src/exception.rs index fd5e4a53..f87ce7c8 100644 --- a/crates/shirabe-php-shim/src/exception.rs +++ b/crates/shirabe-php-shim/src/exception.rs @@ -94,7 +94,7 @@ impl AnyThrowable { } /// The exception a Rust error carries, or `None` if it carries none. - // TODO(phase-c): this matches only an error that *is* the exception, where [`Catch`]'s + // TODO(error-model): this matches only an error that *is* the exception, where [`Catch`]'s // `anyhow::Error` impl also sees one behind an `anyhow::Context` layer. Nothing in the port // adds context to an error yet, so an exception wrapped that way would go silently unseen. pub fn of<'e>(error: &'e (dyn std::error::Error + 'static)) -> Option<&'e Self> { diff --git a/crates/shirabe-php-shim/src/filter.rs b/crates/shirabe-php-shim/src/filter.rs index bbd9a56d..fa2c84ed 100644 --- a/crates/shirabe-php-shim/src/filter.rs +++ b/crates/shirabe-php-shim/src/filter.rs @@ -1,4 +1,4 @@ -// TODO(phase-c): +// TODO(php-semantics): // Without FILTER_NULL_ON_FAILURE, php_filter_boolean trims surrounding // whitespace, lowercases, and yields true only for "1"/"true"/"on"/"yes"; // every other input (including the "0"/"false"/"off"/"no"/"" set) yields @@ -11,7 +11,7 @@ pub fn filter_var_boolean(value: &str) -> bool { ) } -// TODO(phase-c): PHP's FILTER_VALIDATE_URL parses with php_url_parse_ex and +// TODO(php-semantics): PHP's FILTER_VALIDATE_URL parses with php_url_parse_ex and // additionally validates the host as a domain/IPv6 literal. reqwest::Url // (WHATWG/RFC 3986) is stricter on some inputs and more lenient on others, // so this is not a byte-for-byte compatible validator. @@ -19,7 +19,7 @@ pub fn filter_var_url(value: &str) -> bool { reqwest::Url::parse(value).is_ok() } -// TODO(phase-c): +// TODO(pcre): // PHP's FILTER_VALIDATE_EMAIL applies a long PCRE with length lookaheads, // quoted local parts, and bracketed IP-literal domains, which the `regex` crate // cannot express. This is a simplified validator covering the common @@ -67,7 +67,7 @@ fn is_valid_email_domain(domain: &str) -> bool { }) } -// TODO(phase-c): +// TODO(php-semantics): // PHP's FILTER_VALIDATE_IP accepts both IPv4 and IPv6 literals. Rust's IpAddr // parser is a close match (both reject leading zeros in IPv4 octets), but is not // guaranteed byte-for-byte identical to PHP's hand-written validator on exotic @@ -76,7 +76,7 @@ pub fn filter_var_ip(value: &str) -> bool { value.parse::<std::net::IpAddr>().is_ok() } -// TODO(phase-c): +// TODO(php-semantics): // Mirrors PHP's FILTER_VALIDATE_INT with min_range/max_range: surrounding // whitespace is trimmed, an optional sign is allowed, leading zeros are rejected // (except a lone "0"), and the parsed value must fall within [min, max] diff --git a/crates/shirabe-php-shim/src/fs.rs b/crates/shirabe-php-shim/src/fs.rs index 6aa8eeee..c5a4bdf5 100644 --- a/crates/shirabe-php-shim/src/fs.rs +++ b/crates/shirabe-php-shim/src/fs.rs @@ -385,7 +385,7 @@ pub fn fwrite(stream: &PhpResource, data: impl AsRef<[u8]>, length: Option<i64>) } /// PHP `fread()`. Reads up to `length` bytes. -/// TODO(phase-e): byte-string semantics — should return Vec<u8>; from_utf8_lossy can corrupt +/// TODO(bytes): byte-string semantics — should return Vec<u8>; from_utf8_lossy can corrupt /// binary reads (filesAreEqual / binary copy). pub fn fread(stream: &PhpResource, length: i64) -> Option<String> { let cap = length.max(0) as usize; @@ -449,7 +449,7 @@ pub fn fclose(stream: &PhpResource) -> bool { /// PHP `fgets()`. Reads one line, including the trailing newline, capped at `length-1` bytes /// when given (matching PHP's `length` parameter). -/// TODO(phase-e): byte-string semantics — should return Vec<u8>; from_utf8_lossy can corrupt +/// TODO(bytes): byte-string semantics — should return Vec<u8>; from_utf8_lossy can corrupt /// binary reads. pub fn fgets(stream: &PhpResource, length: Option<i64>) -> Option<String> { let limit = match length { @@ -507,7 +507,7 @@ fn fgets_read_line<R: std::io::Read + ?Sized>( } /// PHP `fgetc()`: reads a single byte, or `None` at end-of-stream. -/// TODO(phase-e): byte-string semantics — should return Vec<u8>. +/// TODO(bytes): byte-string semantics — should return Vec<u8>. pub fn fgetc(stream: &PhpResource) -> Option<String> { let mut byte = [0u8; 1]; match stream { @@ -793,7 +793,7 @@ pub fn chmod(path: impl AsRef<std::path::Path>, mode: u32) -> bool { pub fn fileperms(path: impl AsRef<std::path::Path>) -> Result<u32, std::io::Error> { use std::os::unix::fs::MetadataExt; - // TODO(phase-e): PHP returns the full st_mode (file type bits included). + // TODO(php-semantics): PHP returns the full st_mode (file type bits included). std::fs::metadata(path.as_ref()).map(|m| m.mode()) } @@ -843,7 +843,7 @@ pub fn is_dir(path: impl AsRef<std::path::Path>) -> bool { /// PHP `readlink()`: the target the link points at, without resolving it further. /// `None` is PHP's `false`-on-failure. -/// TODO(phase-e): byte-string semantics -- PHP returns the raw bytes of the link target. +/// TODO(bytes): byte-string semantics -- PHP returns the raw bytes of the link target. pub fn readlink(path: impl AsRef<std::path::Path>) -> Option<String> { std::fs::read_link(path) .ok() @@ -880,7 +880,7 @@ pub fn file_put_contents(path: &str, data: &[u8]) -> Option<i64> { } pub fn file_put_contents3(filename: &str, data: &str, flags: i64) -> Option<i64> { - // TODO(phase-c): the LOCK_EX and FILE_USE_INCLUDE_PATH flags are ignored; only FILE_APPEND is + // TODO(php-semantics): the LOCK_EX and FILE_USE_INCLUDE_PATH flags are ignored; only FILE_APPEND is // honored. let append = flags & FILE_APPEND != 0; let mut opts = std::fs::OpenOptions::new(); @@ -914,7 +914,7 @@ pub fn file_get_contents5( offset: i64, length: Option<i64>, ) -> Option<String> { - // TODO(phase-c): the stream $context and FILE_USE_INCLUDE_PATH are ignored; only $offset and + // TODO(php-semantics): the stream $context and FILE_USE_INCLUDE_PATH are ignored; only $offset and // $length are applied (to the file read from the local filesystem). // PHP supports the file:// stream wrapper; strip it to read the local file. let path = path.strip_prefix("file://").unwrap_or(path); @@ -1060,7 +1060,7 @@ pub fn sys_get_temp_dir() -> String { // A directory-handle resource. This is a distinct resource kind from the byte streams modeled by // PhpResource; readdir/closedir have no callers yet, so it only records the opened path. -// TODO(phase-c): give it real readdir/closedir behavior (cursor over the entries) when needed. +// TODO(php-semantics): give it real readdir/closedir behavior (cursor over the entries) when needed. #[derive(Debug)] pub struct PhpDirHandle { pub path: std::path::PathBuf, @@ -1097,7 +1097,7 @@ pub fn pathinfo(path: &str, option: i64) -> String { } } -// TODO(phase-c): returns Option<PathBuf> +// TODO(type-model): returns Option<PathBuf> pub fn realpath(path: impl AsRef<std::path::Path>) -> Option<String> { path.as_ref() .canonicalize() diff --git a/crates/shirabe-php-shim/src/json.rs b/crates/shirabe-php-shim/src/json.rs index 1fa86ca7..a3bed2c0 100644 --- a/crates/shirabe-php-shim/src/json.rs +++ b/crates/shirabe-php-shim/src/json.rs @@ -29,7 +29,7 @@ pub fn json_encode_ex<T: serde::Serialize + ?Sized>( // JSON_UNESCAPED_SLASHES and JSON_UNESCAPED_UNICODE set: forward slashes and non-ASCII // characters are emitted verbatim. The two flags below re-apply PHP's default escaping when // they are absent. - // TODO(phase-c): other flags (e.g. JSON_HEX_*, JSON_THROW_ON_ERROR) are not handled yet; add + // TODO(php-semantics): other flags (e.g. JSON_HEX_*, JSON_THROW_ON_ERROR) are not handled yet; add // them when a call site needs them. let mut s = if flags & JSON_PRETTY_PRINT != 0 { // PHP's JSON_PRETTY_PRINT uses a 4-space indent. diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs index 607a8887..63e4226e 100644 --- a/crates/shirabe-php-shim/src/lib.rs +++ b/crates/shirabe-php-shim/src/lib.rs @@ -67,7 +67,7 @@ pub enum PhpMixed { String(String), List(Vec<PhpMixed>), Array(IndexMap<String, PhpMixed>), - // TODO(phase-e): consolidate Object to Array. + // TODO(type-model): consolidate Object to Array. Object(IndexMap<String, PhpMixed>), // Resources, arbitrary objects and callables are intentionally excluded. Do not add these // things to this type. @@ -434,7 +434,7 @@ pub enum StreamBacking { /// A real file on disk (also `/dev/null`); the OS tracks the position. File(std::fs::File), /// `php://memory` and `php://temp` — an in-memory growable buffer. - /// TODO(phase-c): `php://temp/maxmemory:N` spills to a temp file past N bytes; + /// TODO(php-semantics): `php://temp/maxmemory:N` spills to a temp file past N bytes; /// the threshold is ignored here and everything stays in memory. Memory(std::io::Cursor<Vec<u8>>), /// A child process pipe created by `proc_open`. Half-duplex and not seekable. diff --git a/crates/shirabe-php-shim/src/net.rs b/crates/shirabe-php-shim/src/net.rs index 605ee019..e5d3fcf0 100644 --- a/crates/shirabe-php-shim/src/net.rs +++ b/crates/shirabe-php-shim/src/net.rs @@ -45,7 +45,7 @@ thread_local! { // Engine-side hook with no PHP userland counterpart: the HTTP stream layer must call this // after each request, like PHP's http wrapper populating `$http_response_header`. No stream -// layer performs HTTP requests yet (see the TODO(phase-c) in util/remote_filesystem.rs), so +// layer performs HTTP requests yet (see the TODO(http) in util/remote_filesystem.rs), so // until then the store stays empty and the getter below returns None, which matches PHP // before any HTTP stream request was made. pub fn http_record_last_response_headers(headers: Vec<String>) { diff --git a/crates/shirabe-php-shim/src/phar.rs b/crates/shirabe-php-shim/src/phar.rs index a0299a84..dccdfebf 100644 --- a/crates/shirabe-php-shim/src/phar.rs +++ b/crates/shirabe-php-shim/src/phar.rs @@ -265,7 +265,7 @@ fn verify_phar_signature(path: &std::path::Path, bytes: &[u8]) -> anyhow::Result 0x0002 => "sha1", 0x0003 => "sha256", 0x0004 => "sha512", - // TODO(phase-c): OPENSSL phar signatures need an RSA verification decision; they are + // TODO(php-semantics): OPENSSL phar signatures need an RSA verification decision; they are // accepted unverified for now. 0x0010 => return Ok(()), _ => return Err(broken()), diff --git a/crates/shirabe-php-shim/src/preg.rs b/crates/shirabe-php-shim/src/preg.rs index c2ec563b..b0828667 100644 --- a/crates/shirabe-php-shim/src/preg.rs +++ b/crates/shirabe-php-shim/src/preg.rs @@ -423,7 +423,7 @@ pub fn preg_grep2(pattern: impl PregPattern, array: &[&str], flags: i64) -> Vec< // modifiers are handled; PCRE-only constructs (possessive quantifiers, // lookaround, backreferences) are not supported by `regex` and must be avoided // in the caller's pattern. -// TODO(phase-c): replace with a faithful PCRE engine to restore full semantics. +// TODO(pcre): replace with a faithful PCRE engine to restore full semantics. // PCRE treats `\<` and `\>` as escaped literal `<`/`>`, but the `regex` crate // reads them as start/end-of-word boundary assertions. Rewrite those escapes to // the literal characters so PCRE-sourced patterns (e.g. anything run through @@ -597,7 +597,7 @@ pub fn php_regex_anchored(pattern: &str) -> bool { /// compiles to a per-call-site cached `&'static regex::Regex`, instead of going through the /// runtime `PATTERN_CACHE` lookup by string key. Expands to a `(&'static regex::Regex, bool)` /// tuple, ready to pass straight into any `preg_*` function. -// TODO(phase-e): `$php_pattern` is still translated from PHP delimiter/modifier syntax at runtime (on +// TODO(pcre): `$php_pattern` is still translated from PHP delimiter/modifier syntax at runtime (on // first use at each call site). Once call sites pass native `regex`-crate syntax directly, drop // this wrapper and call `regex_macro::regex!` directly. #[macro_export] diff --git a/crates/shirabe-php-shim/src/process.rs b/crates/shirabe-php-shim/src/process.rs index fd8b7d2d..e150d649 100644 --- a/crates/shirabe-php-shim/src/process.rs +++ b/crates/shirabe-php-shim/src/process.rs @@ -63,7 +63,7 @@ pub fn system(command: &str, result_code: Option<&mut i64>) -> Option<String> { *code = result.status.code().unwrap_or(-1) as i64; } // PHP system() passes the command output straight through to the script's output. - // TODO(phase-c): PHP flushes line by line as the command runs; here the whole output is captured + // TODO(php-semantics): PHP flushes line by line as the command runs; here the whole output is captured // and emitted once the command finishes, which changes interleaving/streaming timing. let _ = std::io::stdout().write_all(&result.stdout); let _ = std::io::stdout().flush(); diff --git a/crates/shirabe-php-shim/src/runtime.rs b/crates/shirabe-php-shim/src/runtime.rs index 254a2fe9..286343b4 100644 --- a/crates/shirabe-php-shim/src/runtime.rs +++ b/crates/shirabe-php-shim/src/runtime.rs @@ -289,7 +289,7 @@ pub fn spl_object_hash<T: HasAddress>(object: T) -> String { format!("{:032x}", object.address()) } -// TODO(phase-c): the Windows branch of php_uname is missing. There PHP reports "Windows NT" as the +// TODO(windows): the Windows branch of php_uname is missing. There PHP reports "Windows NT" as the // sysname and derives release/version from the OS version APIs rather than uname(2). pub fn php_uname(mode: &str) -> String { let Ok(utsname) = nix::sys::utsname::uname() else { @@ -339,12 +339,12 @@ pub fn dir() -> String { } pub fn memory_get_usage() -> i64 { - // TODO(phase-c): return PHP's actual emalloc-tracked memory usage instead of a stub 0. + // TODO(php-semantics): return PHP's actual emalloc-tracked memory usage instead of a stub 0. 0 } pub fn memory_get_peak_usage(_real_usage: bool) -> i64 { - // TODO(phase-c): return PHP's actual emalloc-tracked peak memory usage instead of a stub 0. + // TODO(php-semantics): return PHP's actual emalloc-tracked peak memory usage instead of a stub 0. 0 } @@ -355,22 +355,22 @@ pub fn ini_set(_varname: &str, _value: &str) -> Option<String> { } pub fn sapi_windows_vt100_support(_resource: &crate::PhpResource) -> bool { - // TODO(phase-c): Windows-only SAPI function; not defined on the non-Windows target this build + // TODO(windows): Windows-only SAPI function; not defined on the non-Windows target this build // models (function_exists reports it absent). todo!() } pub fn sapi_windows_cp_get(_kind: Option<&str>) -> i64 { - // TODO(phase-c): Windows-only SAPI function; see sapi_windows_vt100_support. + // TODO(windows): Windows-only SAPI function; see sapi_windows_vt100_support. todo!() } pub fn sapi_windows_cp_set(_codepage: i64) -> bool { - // TODO(phase-c): Windows-only SAPI function; see sapi_windows_vt100_support. + // TODO(windows): Windows-only SAPI function; see sapi_windows_vt100_support. todo!() } pub fn sapi_windows_cp_conv(_in_codepage: i64, _out_codepage: i64, _subject: &str) -> String { - // TODO(phase-c): Windows-only SAPI function; see sapi_windows_vt100_support. + // TODO(windows): Windows-only SAPI function; see sapi_windows_vt100_support. todo!() } diff --git a/crates/shirabe-php-shim/src/stream.rs b/crates/shirabe-php-shim/src/stream.rs index 6ecf80f5..bd5e10af 100644 --- a/crates/shirabe-php-shim/src/stream.rs +++ b/crates/shirabe-php-shim/src/stream.rs @@ -7,7 +7,7 @@ pub const STREAM_NOTIFY_FILE_SIZE_IS: i64 = 5; pub const STREAM_NOTIFY_PROGRESS: i64 = 7; /// PHP `stream_get_contents()`: read the remaining bytes from the stream's current position. -/// TODO(phase-e): byte-string semantics — should return Vec<u8>; from_utf8_lossy can corrupt +/// TODO(bytes): byte-string semantics — should return Vec<u8>; from_utf8_lossy can corrupt /// binary reads. pub fn stream_get_contents(stream: &PhpResource) -> Option<String> { stream_read_remaining(stream, None) @@ -80,7 +80,7 @@ pub fn stream_isatty(stream: PhpResource) -> bool { /// PHP `stream_is_local()`: true for plain paths and the `file://` wrapper, false for remote /// wrappers (`http://`, `ftp://`, ...). -/// TODO(phase-c): PHP asks the wrapper registered for the path's scheme whether it is flagged +/// TODO(php-semantics): PHP asks the wrapper registered for the path's scheme whether it is flagged /// `STREAM_IS_URL`; this classifies by the scheme itself, so a registered custom wrapper claiming to /// be local (or vice versa) comes out differently than in PHP. pub fn stream_is_local(path: &str) -> bool { diff --git a/crates/shirabe-php-shim/src/string.rs b/crates/shirabe-php-shim/src/string.rs index e53fc02c..de1a3b6e 100644 --- a/crates/shirabe-php-shim/src/string.rs +++ b/crates/shirabe-php-shim/src/string.rs @@ -23,7 +23,7 @@ pub fn substr_count(haystack: &str, needle: &str) -> i64 { } // Byte-based, matching PHP's substr_replace. -// TODO(phase-c): PHP accepts negative $start/$length (counting from the end); this signature takes +// TODO(php-semantics): PHP accepts negative $start/$length (counting from the end); this signature takes // usize and therefore cannot express those cases. pub fn substr_replace(string: &str, replace: &str, start: usize, length: usize) -> String { let bytes = string.as_bytes(); @@ -389,7 +389,7 @@ pub fn mb_detect_encoding( } pub fn mb_strwidth(s: &str, _encoding: Option<&str>) -> i64 { - // TODO(phase-c): calculate actual width + // TODO(unicode): calculate actual width s.len() as i64 } @@ -979,7 +979,7 @@ pub fn php_strip_whitespace(path: impl AsRef<std::path::Path>) -> Result<String, pub fn hexdec(s: &str) -> i64 { // PHP hexdec() ignores characters outside [0-9A-Fa-f]. - // TODO(phase-c): PHP promotes the result to float on overflow; this i64 return wraps instead. + // TODO(php-semantics): PHP promotes the result to float on overflow; this i64 return wraps instead. let mut acc: u64 = 0; for &b in s.as_bytes() { let d = match b { @@ -1077,7 +1077,7 @@ pub fn uniqid(prefix: &str, more_entropy: bool) -> String { .unwrap_or_default(); let base = format!("{}{:08x}{:05x}", prefix, now.as_secs(), now.subsec_micros()); if more_entropy { - // TODO(phase-c): PHP uses its combined LCG; this uses `fastrand`, so the random suffix is + // TODO(php-semantics): PHP uses its combined LCG; this uses `fastrand`, so the random suffix is // not reproducible against PHP (it is non-deterministic in PHP too). format!("{}.{:.8}", base, fastrand::f64() * 10.0) } else { diff --git a/crates/shirabe-php-shim/src/url.rs b/crates/shirabe-php-shim/src/url.rs index 92ed389b..27463ce0 100644 --- a/crates/shirabe-php-shim/src/url.rs +++ b/crates/shirabe-php-shim/src/url.rs @@ -32,7 +32,7 @@ pub fn parse_url(url: &str, component: i64) -> PhpMixed { } pub fn parse_url_all(url: &str) -> PhpMixed { - // TODO(phase-c): PHP's parse_url uses php_url_parse_ex, which accepts relative + // TODO(php-semantics): PHP's parse_url uses php_url_parse_ex, which accepts relative // and partial URLs and leaves an absent component absent. reqwest::Url // (WHATWG/RFC 3986) requires an absolute URL, lowercases the host of special // schemes, and normalizes the path (e.g. "http://host" yields path "/"). This diff --git a/crates/shirabe-php-shim/src/var.rs b/crates/shirabe-php-shim/src/var.rs index 293997e4..79704df1 100644 --- a/crates/shirabe-php-shim/src/var.rs +++ b/crates/shirabe-php-shim/src/var.rs @@ -59,7 +59,7 @@ fn serialize_into(out: &mut String, value: &PhpMixed) { } } -// TODO(phase-c): PHP's serialize uses serialize_precision (-1 => shortest round-trip), which Rust's +// TODO(php-semantics): PHP's serialize uses serialize_precision (-1 => shortest round-trip), which Rust's // default float formatting also produces, but the two differ on scientific-notation spelling (PHP // "1.0E+20" vs Rust "1e20") for very large/small magnitudes. fn serialize_float(f: f64) -> String { @@ -188,7 +188,7 @@ pub fn is_numeric_to_int(value: &PhpMixed) -> i64 { /// Approximates PHP's `<=>` for two strings: if both are numeric strings, compare numerically /// (as PHP does), otherwise fall back to a byte-wise comparison. /// -/// TODO(phase-c): this only covers the string/string case of PHP's loose comparison. PHP's `<=>` has many +/// TODO(php-semantics): this only covers the string/string case of PHP's loose comparison. PHP's `<=>` has many /// more special-cased rules across other operand type combinations (bool, array, null, object, /// numeric-string-vs-non-numeric-string, ...). Extend this if a new caller needs those. pub fn loosely_compare(a: &str, b: &str) -> std::cmp::Ordering { |
