Skip to content

Releases

0.5.0

Choose a tag to compare

@iliaal iliaal released this 20 Nov 15:04
0.5.0
9194af7

Added

  • Prebuilt PHP 8.6 binaries attached to releases: Linux (glibc x86_64 and arm64), macOS (arm64), and Windows DLLs (x64 and x86, TS and NTS).

Fixed

  • BMPM preserves the combining dot when lowercasing Turkish capital İ, matching Commons Codec rule contexts and encodings (for example, İhsan). bmpm_match() uses the corrected encoding; DM Soundex is unchanged.

Performance

  • BMPM extends phonemes in place for rules with one alternative and no language restriction, reuses one builder across each final pass, finds ASCII rule buckets and rulesets through tables built at startup, and sorts final sets of up to 32 phonemes by insertion. bmpm() and bmpm_match() take 10-23% less time on a list of Latin-script surnames (Linux x86-64; GCC 12 and 14, Clang 18). Encodings, matches, and budget errors are unchanged.
  • BMPM rule contexts are classified and parsed once at startup instead of on every candidate rule match, and language guessing tests a rule's required letters with one bitmask check. bmpm() and bmpm_match() take about 10-20% less time on Latin-script surnames. Matching rules are unchanged; tests/bmpm_corpus_digest.phpt pins the encodings of a generated corpus for each name type and accuracy, and for each named forced language at approximate accuracy.
  • BMPM language guessing skips rules whose required non-ASCII letters are absent from the input, as it already did for ASCII letters. bmpm() runs 15-25% faster on Latin-script surnames and 40-55% faster on accented and Cyrillic names; encoded output is unchanged.
  • Daitch-Mokotoff Soundex orders each first-byte rule bucket longest-first at startup, allowing encoding to stop at the first matching pattern. Encoded codes, branch order, matching behavior, and resource limits are unchanged.
  • Daitch-Mokotoff Soundex compares rule patterns inline after the bucket's first byte, and compares and hashes branch codes as one zero-padded 8-byte word instead of with strcmp() and a per-byte FNV-1a hash. dm_soundex() and dm_soundex_match() take about 13-20% less time on name lists. Codes, branch order, matches, work-budget errors, the input byte cap, and the 128-branch cap are unchanged; tests/dm_soundex_corpus_digest.phpt pins the codes and matches of a generated corpus.
  • Daitch-Mokotoff Soundex keeps the cleaned input in a 256-byte stack buffer and each branch set's first 8 branches inline, and tracks code-alternative lengths instead of calling strlen(), memcmp(), and strcmp() on replacements of at most 3 characters. dm_soundex() and dm_soundex_match() take about 15-21% less time on name lists. Longer cleaned inputs and larger sets move to heap storage. Codes, branch order, matches, work-budget errors, the input byte cap, and the 128-branch cap are unchanged; tests/dm_soundex_corpus_digest.phpt pins the codes and matches of a generated corpus.
  • NYSIIS uses stack scratch space for inputs shorter than 128 bytes, avoiding a temporary heap allocation in both nysiis() and nysiis_match(). Longer inputs keep the heap-backed path; encoded keys and length limits are unchanged.
  • bmpm_match() compares a single indexed phonetic token directly instead of building a hash table, avoiding temporary table and token-key allocations. Grouped output and exact token boundaries retain the same matching behavior.
  • Double Metaphone folds input and builds both codes in 128-byte stack buffers that move to the heap only when they fill, and double_metaphone() inserts its primary and alternate keys as strings interned at startup. double_metaphone() and double_metaphone_match() take about 42-45% less time on name lists. Codes and match results are unchanged; tests/double_metaphone_corpus_digest.phpt pins them for a generated corpus at several code lengths.

0.4.6

Choose a tag to compare

@iliaal iliaal released this 26 Oct 18:51
0.4.6
8b65f02

Fixed

  • The 0.4.5 prebuilt Linux and macOS binaries failed on PHP 8.4 releases before 8.4.27 and PHP 8.5 releases before 8.5.12 with undefined symbol: smart_str_ferealloc, because they were compiled against newer PHP headers. Prebuilt binaries are now compiled against the oldest patch release of each PHP minor (8.4.1 and 8.5.0), and the release workflow rejects a binary that imports a symbol that release does not export or that fails to load and run on the oldest and newest patch. Source builds were unaffected.

0.4.5

Choose a tag to compare

@iliaal iliaal released this 26 Oct 15:25
0.4.5
539f916

Performance

  • Double Metaphone encodes directly from its padded folding buffer instead of allocating a second full-input copy. Both the encoder and match helper retain their existing keys, matching rules, and folded-input limit.

Fixed

  • bmpm_match() no longer treats identical prefixed inputs as a match when their encoding contains only empty prefix groups, with no phonetic tokens. Regression coverage: tests/bmpm_match_empty_prefix.phpt.
  • CI test guards preserve failing runner exit statuses in ASAN and Windows jobs, including the Windows release build, even after a passing test summary.

0.4.4

Choose a tag to compare

@iliaal iliaal released this 13 Oct 01:15
0.4.4
8e172b3

Changed

  • bmpm() / bmpm_match(): resource-budget overruns now throw catchable ValueError exceptions instead of terminating the request with E_ERROR. Callers can catch the exception and continue; normal finally blocks and object cleanup run. Short inputs can still exceed a budget.
  • Match Rating streams encoding into a six-byte codex, using constant temporary memory even for long inputs in match_rating() and match_rating_compare().
  • Daitch-Mokotoff Soundex stops applying rules once every branch has its final six digits, avoiding unnecessary suffix work without changing code order.
  • Daitch-Mokotoff Soundex reuses unchanged branch transitions for repeated branching rules, avoiding repeated work while preserving code order and the 4096-byte input limit.
  • dm_soundex() / dm_soundex_match(): capped executed branch/replacement expansions at 32,768 per encoded operand, excluding reused transitions. Inputs that exceed this budget now throw catchable ValueError exceptions without returning partial codes. Match operands have independent budgets; in-budget encodings retain their code order and 128-branch cap.
  • NYSIIS stops transcoding once the requested key prefix is stable, avoiding unnecessary suffix work while preserving final cleanup and unlimited output.
  • NYSIIS compacts its key in the existing cleaned-input buffer, avoiding a second input-sized temporary allocation without changing encoded keys.

Fixed

  • bmpm() / bmpm_match(): capped serialized output at 256 times the original input byte length, including separators and prefix punctuation. Each match operand has its own cap. Oversized output raises ValueError without returning a partial encoding.
  • Documented the exact BMPM resource counters and corrected the vendored Hebrew helper-file description: no loaded rule set includes those files.
  • The arginfo consistency guard rejects octal, nonliteral, incomplete, or duplicate BMPM accuracy declarations instead of accepting decimal-looking values.
  • bmpm() / bmpm_match() / dm_soundex() / dm_soundex_match(): fold the Unicode KELVIN SIGN (U+212A) to lowercase ASCII k, matching Commons Codec.

0.4.3

Choose a tag to compare

@iliaal iliaal released this 04 Sep 01:02
0.4.3
cb42a3b

Fixed

  • CI: Windows lanes locate the lane-matching php.exe instead of assuming build/php-bin/php.exe; release gates reuse the located binary.

0.4.2

Choose a tag to compare

@iliaal iliaal released this 04 Sep 00:46
0.4.2
77a503d

Changed

  • bmpm_match(): each operand gets a full per-encode work allowance instead of sharing one budget, so two individually-legal inputs no longer fail together. - dm_soundex() / dm_soundex_match(): branch-set saturation keeps the first 128 distinct codes (deterministic) instead of raising E_ERROR. - Rule data: Daitch-Mokotoff tables moved from src/bmpm_data.h to generated src/dm_data.h (contents identical); the generator validates language rows. - Oracle parity matrix grows to 684 rows with a forced-language BMPM mode.

Fixed

  • CI: warning gate no longer masks make failures; Windows job fails closed on all-SKIP; timeout-minutes everywhere; warnings gated on macOS and Windows. - Parity checker: fixture tests for every fail-closed guard; exact oracle pins in budget tests; golden regen-and-diff runs in CI. - Docs: MRA identical-raw exception, stub @throws/fatal notes, dead J advance removed from double_metaphone() (no behavior change).

0.4.1

Choose a tag to compare

@iliaal iliaal released this 30 Aug 18:12
0.4.1
a83dc5a

Security

  • svgTo*() reject caller SVG whose element-count times output-pixels exceeds a render-work budget (CPU exhaustion past the complexity caps).
  • Dashed strokes with non-finite or float32-frozen segment lengths no longer loop unbounded; a per-path budget caps the dashed clone.
  • Curve flattening is bounded per-cubic and per-path, so many non-converging cubics can no longer drive billions of subdivisions.
  • A single path d attribute is capped in element count; the partial prefix still renders (SVG path-data error handling).
  • The scanline rasterizer no longer truncates the scanline index to 32 bits (out-of-bounds access on path coordinates at multiples of 2^32).
  • Decompression-bomb PNGs via setBackgroundImage() / addIconAt() decode into a fixed IHDR-sized buffer instead of inflating to ~2 GiB.
  • Scan-less or truncated JPEGs no longer leak recycled worker heap bytes; decoder component planes are zero-initialized.

0.4.0

Choose a tag to compare

@iliaal iliaal released this 27 Jul 01:16
0.4.0
d63f997

Changed

  • BREAKING: BMPM_APPROX is now 10 and BMPM_EXACT is now 20 (were 1 and 2). The accuracy values are now disjoint from the name-type values (BMPM_GENERIC/BMPM_ASHKENAZI/BMPM_SEPHARDIC = 0/1/2), so a misplaced constant such as bmpm($name, BMPM_APPROX) is rejected by argument validation instead of silently running as a name type. Code that uses the constant names is unaffected; only code hard-coding the numeric values 1/2 for the $accuracy argument needs updating.
  • bmpm() / bmpm_match(): forced $language = "any" now raises ValueError; it is the default ruleset label. Pass an empty string for auto-detect.
  • double_metaphone(): stops encoding once both codes reach max_length. Same results, less work on long inputs.
  • Match helpers skip the second encode when the first operand is unencodable or the two operands are identical.
  • bmpm(): BMPM_MAX_PREFIX_DEPTH lowered from 16 to 6, bounding the prefix dual-encode fan-out. Still above realistic name nesting.
  • bmpm() MINIT hard-fails on an oversize generated language list, language bracket, or phoneme alternative list instead of silently clipping it.
  • Internal BMPM rule-type tokens renamed to BMPM_RT_APPROX / BMPM_RT_EXACT so they cannot collide with the public accuracy constants.
  • Shared PHONETIC_MAX_RULED_INPUT (4096) for BMPM and DM Soundex caps; generated DMS_CAP_* macros size DM replacement alt buffers.
  • match_rating_compare(): skip second encode when the first cleans to empty.
  • config.w32: require PHP 8.1+ (parity with config.m4).
  • Docs: forced-language API note; Double Metaphone unmapped non-ASCII fold; DM index example queries every non-000000 code; LICENSE Section 2.
  • CI: PIE smoke pins a false bmpm_match and Double Metaphone match strengths; Windows jobs assert php_phonetic.dll was produced after the builder step.
  • scripts/check_arginfo.php locks PH_BMPM_* accuracy ints to the stub; smoke no longer hardcodes the version string; regen_arginfo docs fixed.
  • scripts/regen_arginfo.sh: prefers $HOME/php-install-PHP-8.1/bin/php when PHP_BIN is unset; documents tokenizer/gen_stub requirements.

Fixed

  • double_metaphone(): JOSE/SAN J branch no longer applies the double-J advance (Commons Codec handleJ advances by 1 on that arm only).
  • double_metaphone_match(): a code counts as unencodable only when both the primary and the alternate are empty, so "-EW" (""/"F") still crosses at strength 1 in either argument order.
  • dm_soundex(): U+0085 is kept, not stripped. Java's Character.isWhitespace excludes it, so Commons Codec keeps it too.
  • bmpm() MINIT: zero-initialize ruleset/language indexes so a mid-build abort cannot free garbage pointers on unload.
  • bmpm(): overflow-safe allocation for phoneme-set growth and prefix pair buffers.
  • bmpm(): the final-rule merge sorts once instead of an O(R²) insert-sort, and hashes duplicates only when the phoneme texts are wide enough to pay for it.
  • bmpm(): rule-matching inner loops compare code points inline again; routing 1-3 element compares through memcmp() cost 5-6% of encode time.
  • nysiis(): corrected a source comment that claimed parity with Commons Codec's SoundexUtils.clean; the ASCII-only cleaning is a deliberate restriction.
  • scripts/gen_bmpm_data.php: src/bmpm_data.h is written to a temp file and renamed into place, so an interrupted run can't leave a truncated header.
  • Docs: Cyrillic lowercasing is bmpm()-only; DM "000000" dual meaning; MRA identity short-circuit; forced-language "any"; NFC vs NFD.
  • Docs/tests: empty/unencodable match contracts, BMPM validation and accuracy values, bmpm_match accuracy forwarding, and word-final J alternate space.
  • Tests: match-helper oracle pins, cleaned-empty identity pins, multi-code dm_soundex_match, dual-sentinel, MRA first3+last3, SEPHARDIC/any errors.

0.3.0

Choose a tag to compare

@iliaal iliaal released this 10 Jul 02:17
0.3.0
e4fd2ea

Fixed

  • double_metaphone(): four rules now follow the published Philips algorithm (thumb 0M|TM, high/hugh H, jose HS|HS, mooch MK).
  • double_metaphone(): leading/trailing whitespace (any byte <= U+0020) is trimmed, so "\tOtto" and "\nKNIGHT" keep their word-start anchors.
  • double_metaphone(): -gier uses the French soft-G branch anywhere, not only word-final, so brigier codes PRJ|PRJR and angiera codes ANJR|ANJR.
  • double_metaphone(): malformed UTF-8 folds byte-wise instead of swallowing the letters after a stray lead byte.
  • UTF-8 decoding (all encoders): overlong, UTF-16 surrogate, and above-U+10FFFF sequences fold the lead byte to Latin-1 rather than decoding as a code point.
  • bmpm() and dm_soundex(): U+1E9E (ẞ) folds to ß, so STRAẞE encodes like Straße.
  • bmpm_match(): token intersection handles the (remainder)-(combined) prefix group syntax, so bmpm_match("van Smith", "Smith") is true.
  • bmpm() / bmpm_match(): a forced $language is honoured inside the prefix/d' split (deliberate divergence from Commons Codec).
  • bmpm() / bmpm_match(): the invalid-$language exception preview is binary-safe (non-printables as ?) and bounded to 32 bytes.
  • bmpm(): leading/trailing control characters (<= U+0020) are trimmed.
  • dm_soundex_match(): two inputs that match no rule no longer compare equal via the padded "000000" sentinel.
  • U+0130 (İ) lower-cases to i in bmpm() and dm_soundex(), so İstanbul matches istanbul.

Security

  • match_rating() and match_rating_compare() no longer write past the clean buffer on a bare Latin-1 0xDF that expands to SS.
  • bmpm() and bmpm_match() reject input over 4096 bytes with a ValueError, matching the Daitch-Mokotoff cap.

Changed

  • The five comparison helpers' parameters are named $a/$b (affects named-argument calls only).
  • composer.json license is the SPDX expression BSD-3-Clause AND Apache-2.0 (was a disjunctive array).
  • The README BMPM token-splitting recipe splits on (, ), |, - with PREG_SPLIT_NO_EMPTY, matching bmpm_match()'s tokenizer.
  • Performance: bmpm() decodes input once and pre-parses rules at init; Double Metaphone, Daitch-Mokotoff, and NYSIIS drop per-call allocations.

For contributors

  • macOS CI builds with --enable-phonetic-dev, enforcing the same warning-clean build as Linux.
  • Generated BMPM table decoding fails module init if a checked-in table exceeds the C buffer caps.
  • CI preflights extension_loaded("phonetic") and fails on any skipped/borked/leaked test, so a silent load failure can't pass green.
  • scripts/pie-smoke.sh treats a pie install failure as fatal (opt out with ALLOW_MANUAL_FALLBACK=1).

0.2.0

Choose a tag to compare

@iliaal iliaal released this 30 Jun 18:10
0.2.0
905b801

Added

  • nysiis(string $string, int $max_length = 6): string. NYSIIS encoder (clean-room), with parity to Apache Commons Codec's Nysiis. $max_length <= 0 returns the full, non-truncated key.
  • match_rating(string $string): string. Match Rating Approach codex (clean-room), with parity to Apache Commons Codec.
  • double_metaphone_match(string $a, string $b, int $max_length = 4): int. Double Metaphone match strength: 2 when the primary keys agree, 1 when an alternate key crosses, 0 for no match.
  • bmpm_match(string $a, string $b, int $name_type = BMPM_GENERIC, int $accuracy = BMPM_APPROX, string $language = ""): bool. True when two names share a Beider-Morse phoneme token.
  • dm_soundex_match(string $a, string $b): bool. True when two names share a Daitch-Mokotoff code.
  • nysiis_match(string $a, string $b, int $max_length = 6): bool. True when two names produce the same NYSIIS key.
  • match_rating_compare(string $a, string $b): bool. Match Rating Approach homophone test (isEncodeEquals), applying the length and minimum-rating rules.
  • Prebuilt binaries attached to releases: Linux (glibc x86_64 and arm64) and macOS (arm64) for PHP 8.4 and 8.5, alongside the existing Windows DLLs.

Fixed

  • match_rating(): count UTF-8 code points, not bytes, in the trivial-input guard, so a lone multi-byte letter has no code (match_rating("é") is now "").
  • match_rating(): expand ß to SS before folding accents, so match_rating("Straße") returns "STRS".

Security

  • dm_soundex() and dm_soundex_match(): reject input over 4096 bytes with a ValueError, so untrusted long input cannot become a multi-second CPU sink.
  • bmpm(): skip and reject zero-length rule patterns, closing a latent infinite-loop path against a corrupted rule set.

Performance

  • dm_soundex(): O(1) hashed branch-set dedup for branchy input (threshold-gated so short names keep the linear path), making long input scale linearly.
  • match_rating_compare(): stack scratch buffer in the comparison pass instead of two heap allocations per call.