Skip to content
Back to skills

Php Knowledge Patch

ASecurity

PHP

  • 25 stars
  • 0 votes
  • 0 copies
  • 8 views
  • Added September 5, 2026
developmentgophpsqlexpressapidatabasesecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill php-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Php Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Php Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-php-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-php-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: php-knowledge-patch
description: PHP
version: "8.6.0"
license: MIT
metadata:
  author: Nevaberry
---


# PHP Compatibility Guidance

Load this skill when migrating PHP code, addressing deprecations or changed
error behavior, configuring PHP deployments, or using the extension APIs below.
Read the relevant topic reference for full conditions, examples, and release
attributions. The quick reference prioritizes breaking changes and deprecations.

## Reference index

| Reference | Topics |
| --- | --- |
| [Language and runtime](references/language-and-runtime.md) | Declarations, attributes, cloning, reflection, comparisons, diagnostics, serialization, WeakMap, FFI |
| [Configuration, filesystem, and SPL](references/configuration-filesystem-and-spl.md) | Security updates, builds, CLI, INI, OPcache, FPM, sessions, files, CSV, iterators, streams, archives |
| [Databases and PDO](references/databases-and-pdo.md) | DSNs, SQL parsing, fetch modes, MySQLi, PostgreSQL, SQLite, Firebird, ODBC, OCI8 |
| [Networking, crypto, and processes](references/networking-crypto-and-processes.md) | cURL, OpenSSL, TLS, Sodium, sockets, HTTP, URIs, LDAP, PCNTL, mail, SNMP |
| [Text, internationalization, and media](references/text-intl-and-media.md) | Strings, PCRE, MBString, Intl, dates, filtering, JSON, GMP, GD, EXIF, image formats |
| [XML, SOAP, and XSL](references/xml-soap-and-xsl.md) | DOM, XPath, SimpleXML, XML parsing, SOAP connections and types, XSL transformations |

## Breaking changes and deprecations

### Build, CLI, and configuration

- OPcache is built into and loaded by PHP. Remove `--enable-opcache` and
  `--disable-opcache` from build scripts and the `zend_extension` line loading
  `opcache.so` or `php_opcache.dll`. Control caching with `opcache.enable` and
  `opcache.enable_cli`.
- PHP 8.5 removes the `-z` flag from CLI and CGI. Load external Zend extensions
  with `zend_extension` in INI configuration.
- Deriving `$_SERVER['argc']` and `$_SERVER['argv']` from the query string in
  non-CLI SAPIs is deprecated. Set `register_argc_argv=0` for web SAPIs and read
  validated request data from `$_GET` or `$_SERVER['QUERY_STRING']`.
- PHP 8.3 resolves `open_basedir` paths on updates and disallows `..` components
  in runtime updates. Pass a resolved absolute directory to
  `ini_set('open_basedir', $directory)` when narrowing the allowed paths.
- `PHP_DEBUG` and `PHP_ZTS` are booleans. Update strict comparisons that expect
  integer flags.

### Language and runtime

- A comparison that encounters recursion throws a catchable `Error`.
- `__clone()` can still reinitialize a `readonly` property by direct assignment.
  Indirect modification, including binding a reference to it, is forbidden
  during cloning.
- Date, Intl, PDO, Reflection, SPL, SQLite, and XMLReader declare types on class
  constants. Check that overrides in subclasses have compatible types.
- Applying `#[\Attribute]` to an abstract class, enum, interface, or trait fails
  at compile time. Add `#[\DelayedTargetValidation]` to defer validation to
  `ReflectionAttribute::newInstance()`.
- Destructuring a non-array with `[]` or `list()` emits a warning; a `null`
  right-hand side is exempt. Explicit and implicit casts to `int` warn when a
  float or float-like string falls outside the integer range. Casting `NAN`
  to another type also warns.
- Emitting output inside a user output handler is deprecated. Return the
  transformed text. The deprecation diagnostic bypasses that handler and can
  still pass through the next outer handler.
- Calling `ReflectionClass::getConstant()` for an absent constant or
  `ReflectionProperty::getDefaultValue()` for a property without a default is
  deprecated. Guard with `hasConstant()` and `hasDefaultValue()`, respectively.
- A `return` inside `finally` is deprecated. Keep cleanup there and return from
  the enclosing function after the block. Returning a value from `__construct()`
  or `__destruct()` and a nullable return type on `__debugInfo()` are deprecated.
- Passing a class-name string to `is_a()` or `is_subclass_of()` with
  `$allow_string` set to `false` is deprecated. Pass an object or explicitly
  allow class-name strings when the check is intended to accept them.

### Database connections and fetching

- The `uri:` DSN scheme is deprecated. Pass the driver's DSN directly to PDO.
  PostgreSQL DSN credentials take precedence over corresponding constructor
  arguments.
- Inside PostgreSQL dollar-quoted SQL strings, write one `?` for a literal
  question mark; the old `??` escape inside them is deprecated.
- `PDO::FETCH_CLASS` treats string keys in constructor arguments as parameter
  names and requires explicit references for by-reference parameters.
- Calling `setFetchMode()` inside `fetch()`, `fetchObject()`, or `fetchAll()`
  throws `Error`. `FETCH_PROPS_LATE` outside `FETCH_CLASS`, and `FETCH_INTO` with
  `fetchAll()`, throw `ValueError`. Use named PDO fetch constants because several
  flag values changed.
- PDO_SQLITE `PDO::quote()` raises an exception or warning for a string with a
  NUL byte, according to the connection's error mode.
- `mysqli_stmt_init()`, `mysqli::stmt_init()`, and constructing `mysqli_stmt`
  without a query are deprecated. Prepare directly with `$mysqli->prepare($sql)`.
- The two-argument forms of `pg_fetch_result()`, `pg_field_prtlen()`, and
  `pg_field_is_null()` are deprecated. Preserve implicit row selection with
  `null` in the row position, as in `pg_fetch_result($result, null, 'id')`.

### Sessions, files, and SPL

- Changing `session.sid_length` or `session.sid_bits_per_character` is
  deprecated. Prepare storage for 32-character hexadecimal IDs and remove
  overrides of these settings.
- `session_start()` throws `ValueError` if its options array is not a map and
  `TypeError` if `read_and_close` has a value incompatible with `int`.
- Session defaults enable strict mode and HttpOnly and set SameSite to Lax:
  `session.use_strict_mode=1`, `session.cookie_httponly=1`, and
  `session.cookie_samesite=Lax`.
- Custom save handler objects must provide both `create_sid()` and `validateId()`
  to avoid deprecation, including implementations of `SessionHandlerInterface`.
  `SessionHandler::validateId()` implements strict-mode validation for the
  built-in handler.
- Using an object as backing storage for `ArrayObject` or `ArrayIterator` is
  deprecated. `ArrayObject` rejects enum cases.
- `SplFileObject::fgetcsv()`, `fputcsv()`, `setCsvControl()`, and `getCsvControl()`
  are deprecated. Use standalone CSV functions with an open stream for reads
  and writes.
- PHP 8.5 deprecates `null` handles for `readdir()`, `rewinddir()`, and
  `closedir()`. Pass the handle returned by `opendir()`.
- Filesystem metadata and path predicates such as `stat()`, `filesize()`, and
  `is_file()` throw `ValueError` for NUL bytes in filenames. The same applies
  to the first argument of `getenv()` and `putenv()` and the working directory
  argument to `proc_open()`.

### Text, XML, and callbacks

- PCRE patterns using `\K` inside a lookaround are rejected. PHP 8.4.25 and
  8.5.10 forbid `\C` in UTF-8 patterns such as `/\C/u`. Use `.` for a Unicode
  character, adding `s` to include newlines; use byte mode to consume bytes.
- `intl.error_level` is deprecated. Check Intl errors in code or set
  `intl.use_exceptions=1` to handle them as exceptions.
- On PHP 8.4.24 and 8.5.9, `Locale::lookup()` and `locale_lookup()` return `null`
  when a tag cannot be canonicalized, even with a fallback locale. Handle
  `null` explicitly when invalid input requires a fallback.
- The mbregex API and passing objects to `mb_convert_variables()` are deprecated.
  `trim()`, `ltrim()`, and `rtrim()` strip form feed (`\f`) by default; supply
  an explicit character mask when those bytes need to be retained.
- `xml_set_object()`, bare method-name strings, and empty-string handler removal
  are deprecated. Register object methods as callables and pass `null` to clear
  a handler.
- `SoapClient::__doRequest()` adds optional `?string $uriParserClass = null`.
  Update subclass overrides to accept it. Pass `Uri\Rfc3986\Uri::class` or
  `Uri\WhatWg\Url::class` for those parsers, or leave `null` for `parse_url()`.
- Exceptions from cURL callbacks abort the request. An unexpected integer from
  a `CURLOPT_READFUNCTION` callback raises `ValueError`.

## Security and dependency conditions

- Upgrade PHP 8.2, 8.3, 8.4, and 8.5 deployments to their respective security
  releases: 8.2.33, 8.3.33, 8.4.24, and 8.5.9. PHP 8.5.9 fixes the BCMath
  out-of-bounds write CVE-2026-17544 (GHSA-x692-q9x7-8c3f).
- The PHP 8.2.20 and 8.3.8 release notes require OpenSSL with implicit rejection
  for safe use of `openssl_private_decrypt()` with `OPENSSL_PKCS1_PADDING`.
  OpenSSL 3.2 includes it; some distributions backport it to older builds.
- OpenSSL-backed Argon2 hashing requires a non-thread-safe PHP build and
  OpenSSL 3.2 or later.
- SOAP has an optional dependency on the session extension. Load the session
  extension with SOAP on a build configured with `--enable-rtld-now` to avoid
  startup errors.

## New features quick reference

### Objects, constants, and diagnostics

- Constants, attribute arguments, and property or parameter defaults can hold
  closures and first-class callables. Constant expressions can use casts.
- Pass a property map as the second argument to `clone()` to set clone values,
  including readonly properties during cloning.
- `ReflectionProperty::skipLazyInitialization()` or
  `setRawValueWithoutLazyInitialization()` exempts a property from triggering
  initialization. `ReflectionClass::SKIP_INITIALIZATION_ON_SERIALIZE` prevents
  serialization from triggering it. `ReflectionClass::SKIP_DESTRUCTOR` skips
  the destructor when resetting an object as a lazy ghost or proxy.
- Fatal error diagnostics include a backtrace, including when a script exceeds
  its maximum execution time. Use `error_include_args` to control the inclusion
  of function arguments in error output.
- Run `php --ini=diff` in PHP 8.5 to list settings whose effective values differ
  from their built-in defaults.

### Database and cURL controls

- PHP 8.5 lets `Pdo\Pgsql` fetch without buffering the whole result set. Set
  `PDO::ATTR_PREFETCH` to `0` on the connection or an individual statement.
- Set `Pdo\Pgsql::ATTR_CHUNK_SIZE` to the number of rows to fetch per chunk.
- Set `Pdo\Sqlite::ATTR_TRANSACTION_MODE` to choose how `beginTransaction()`
  starts: `TRANSACTION_MODE_DEFERRED`, `TRANSACTION_MODE_IMMEDIATE`, or
  `TRANSACTION_MODE_EXCLUSIVE`.
- `curl_version()['feature_list']` maps feature names to booleans; known but
  unsupported features have value `false`.
- `CURLOPT_PREREQFUNCTION` runs after connection establishment and before the
  request is sent. Return `CURL_PREREQFUNC_OK` or `CURL_PREREQFUNC_ABORT`.
- Register `CURLOPT_SEEKFUNCTION` to rewind a streamed request body for redirects,
  multi-pass authentication, or retries on reused connections. Return
  `CURL_SEEKFUNC_OK`, `CURL_SEEKFUNC_FAIL`, or `CURL_SEEKFUNC_CANTSEEK`.

### Streams, URIs, and data formats

- The URI extension is always enabled and handles RFC 3986 URIs and WHATWG URLs.
  Use `Uri\Rfc3986\Uri::getUriType()` for URI classification and
  `Uri\WhatWg\Url::isSpecialScheme()` for WHATWG special schemes; both classes
  expose `getHostType()`. `Uri\Rfc3986\UriBuilder` constructs RFC 3986 URIs.
- Configure stream context options `error_mode`, `error_store`, and
  `error_handler` to control stream errors. The API adds `stream_last_errors()`
  and `stream_clear_errors()`.
- Filtered streams can be passed to `stream_select()` when their underlying
  stream can supply a file descriptor. `flock()` can lock zlib streams.
- `FILTER_THROW_ON_FAILURE` makes validation failures throw an exception.
  Combining it with `FILTER_NULL_ON_FAILURE` throws `ValueError`.
- `IntlListFormatter` requires ICU 67 or later. Choose `TYPE_AND`, `TYPE_OR`, or
  `TYPE_UNITS` for style and `WIDTH_WIDE`, `WIDTH_SHORT`, or `WIDTH_NARROW` for width.
- The EXIF reader and `getimagesize()` support HEIF and HEIC. With ext-libxml
  loaded, `getimagesize()` supports SVG. The EXIF extension reads WebP metadata.
- Use `ZipArchive::openString()` to open an archive from bytes held in a string.

Files in this skill

  • SKILL.md8.3 KB
  • coverage.json742 B
  • references/configuration-filesystem-and-spl.md4.3 KB
  • references/databases-and-pdo.md3.5 KB
  • references/language-and-runtime.md6.1 KB
  • references/networking-crypto-and-processes.md3.4 KB
  • references/text-intl-and-media.md5 KB
  • references/xml-soap-and-xsl.md4.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.