Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 19 additions & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,7 @@ All notable changes to PL/php are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and the project aims to follow [Semantic Versioning](https://semver.org/).

## [2.4.0] - 2026-07-06

### Fixed

- **Per-function memory contexts.** Each compiled function's descriptor and
subsidiary data (fmgr info records included) now live in their own memory
context, deleted wholesale on redefinition, implementing a FIXME as old
as the file. This also closes a use-after-free window: the compiled-
function cache used to briefly point at freed memory during recompilation,
which an unluckily timed statement cancel could have hit.

## [Unreleased]
## [2.5.0] - 2026-07-06

### Added

Expand Down Expand Up @@ -44,22 +33,15 @@ and the project aims to follow [Semantic Versioning](https://semver.org/).
still enforced on results. Scalar domains were already transparent.
- **Project logo and brand assets.** Light/dark PL/php logos and a square icon
under `doc/assets/`, wired into the README and language reference.
- **Error CONTEXT lines.** Messages raised while PL/php code runs carry a
`CONTEXT: PL/php function "name"` line (or the anonymous-block/compilation
variants), like every other procedural language.

### Fixed

- **Uncaught database errors lost their SQLSTATE, DETAIL and HINT.** An error
that unwound to the top of a PL/php call was reported with only its message
(and `SQLSTATE XX000`); it now carries the original `SQLSTATE`, `DETAIL` and
`HINT` through the `zend_bailout` reporting path.
- **Backend crash when an error crossed nested PL/php calls.** A PostgreSQL
error unwinding out of a handler's `zend_try` left Zend's bailout
environment pointing into a dead stack frame; the next uncaught error then
jumped into garbage. Nested regression cases added.

## [Unreleased]
## [2.4.0] - 2026-07-06

### Added

Expand All @@ -74,14 +56,25 @@ and the project aims to follow [Semantic Versioning](https://semver.org/).
- **ASAN in CI.** A workflow job builds with AddressSanitizer and runs the
suite against a `libasan`-preloaded server, catching memory-safety bugs
mechanically (new `ASAN_FLAGS` hook in the Makefiles).

## [Unreleased]

### Added

- **A reproducible benchmark suite** (`bench/`) and published results
(`doc/benchmarks.md`) comparing PL/php with PL/pgSQL and PL/Perl: within a
few percent on scalar and string work, 1.75× PL/Perl on SPI row loops.
few percent on scalar and string work, 1.75x PL/Perl on SPI row loops.
- **Error CONTEXT lines.** Messages raised while PL/php code runs carry a
`CONTEXT: PL/php function "name"` line (or the anonymous-block/compilation
variants), like every other procedural language.

### Fixed

- **Per-function memory contexts.** Each compiled function's descriptor and
subsidiary data (fmgr info records included) now live in their own memory
context, deleted wholesale on redefinition, implementing a FIXME as old
as the file. This also closes a use-after-free window: the compiled-
function cache used to briefly point at freed memory during recompilation,
which an unluckily timed statement cancel could have hit.
- **Backend crash when an error crossed nested PL/php calls.** A PostgreSQL
error unwinding out of a handler's `zend_try` left Zend's bailout
environment pointing into a dead stack frame; the next uncaught error then
jumped into garbage. Nested regression cases added.

## [2.3.0] - 2026-07-06

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MODULE_big = plphp
OBJS = plphp.o plphp_io.o plphp_spi.o

EXTENSION = plphp
DATA = plphp--2.4.sql plphp--2.0--2.1.sql plphp--2.1--2.2.sql plphp--2.2--2.3.sql plphp--2.3--2.4.sql
DATA = plphp--2.5.sql plphp--2.0--2.1.sql plphp--2.1--2.2.sql plphp--2.2--2.3.sql plphp--2.3--2.4.sql plphp--2.4--2.5.sql

# PHP embed SAPI compile/link flags, discovered via php-config.
PHP_CONFIG ?= php-config
Expand Down
11 changes: 11 additions & 0 deletions plphp--2.4--2.5.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* Upgrade PL/php from 2.4 to 2.5.
*
* 2.5 adds structured pg_raise (DETAIL/HINT/SQLSTATE), TRUNCATE and INSTEAD OF
* trigger support, domains over arrays and composites, and transforms that
* reach nested contexts (trigger rows, composites, set-returning results).
* The companion hstore_plphp transform ships as its own extension. All of it
* lives in the C module, so there is nothing to change at the SQL level.
*/

-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION plphp UPDATE" to load this file. \quit
File renamed without changes.
2 changes: 1 addition & 1 deletion plphp.control
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
# the server's OS user. The extension is therefore superuser-only to install
# and the language is created without the TRUSTED attribute.
comment = 'PL/php procedural language (untrusted)'
default_version = '2.4'
default_version = '2.5'
module_pathname = '$libdir/plphp'
relocatable = false
Loading