Summary
Pre-existing semantic quirk surfaced during the #576 review (PR #577), explicitly deferred there as out of scope. Memory-safe since #577; this is about close() semantics for shared non-persistent connections.
fbird_connect() deduplicates connections per DSN via the EG(regular_list) hash cache (_php_fbird_connect_link, reuse path). Two Firebird\Connection objects created for the same DSN therefore wrap one resource entry:
$a = fbird_connect($dsn);
$b = $driver->connect($dsn); // same underlying entry (cache reuse)
$a->close(); // fires the link dtor -> server link CLOSED
$b->isConnected(); // false - silently disconnected
Old behavior had the same observable effect (non-plink branch always zend_list_close), so nothing regressed in #577 - but with owned refs we now have the machinery to define better semantics.
Questions to answer
- Should closing one of several wrappers sharing an entry disconnect the others? (Current + legacy answer: yes.)
- Reference semantics of PDO_Firebird / other PHP DB exts: most treat each connection handle as independent (no DSN dedup for non-persistent links).
- Options:
- a) Keep current behavior, document it ("close() closes the shared server link")
- b) Per-wrapper logical handles over one physical link (refcounted close: last wrapper closes) - larger change
- c) Disable non-persistent DSN dedup (each connect = own entry) - changes perf characteristics, aligns with other extensions
Related
Acceptance criteria
- Documented decision (docs note at minimum)
- If changed: regression phpt covering two-object share + close order permutations
Summary
Pre-existing semantic quirk surfaced during the #576 review (PR #577), explicitly deferred there as out of scope. Memory-safe since #577; this is about close() semantics for shared non-persistent connections.
fbird_connect()deduplicates connections per DSN via theEG(regular_list)hash cache (_php_fbird_connect_link, reuse path). TwoFirebird\Connectionobjects created for the same DSN therefore wrap one resource entry:Old behavior had the same observable effect (non-plink branch always
zend_list_close), so nothing regressed in #577 - but with owned refs we now have the machinery to define better semantics.Questions to answer
Related
Acceptance criteria