github phalcon/cphalcon v5.24.0

51 minutes ago

5.24.0 (2026-11-28)

Tools

  • Zephir 1.11.0

Changed

  • A callback that cannot be called throws TypeError instead of a warning and null. #17766
  • Faster ACL build in Phalcon\Acl\Adapter\Memory. #17701
  • Faster HTML output of the Phalcon\Flash messages with no icon classes. #17712
  • Faster HTML output of the Phalcon\Flash messages. #17704
  • Faster Phalcon\Acl\Adapter\Memory::isAllowed(). #17711
  • Faster Phalcon\Cache\Cache, the Phalcon\Storage adapters and Phalcon\Acl\Adapter\Memory::isAllowed() when no events manager is set. #17703
  • Faster Phalcon\Config\Config::path(). #17714
  • Faster Phalcon\Logger calls with no excluded adapters. #17713
  • Faster Phalcon\Mvc\Micro requests with the default router service. #17715
  • Faster base64url decode in the JWT parser and Phalcon\Encryption\Crypt::decryptBase64(). #17705
  • Faster construction of Phalcon\Config\Config and its adapters when the config has no type. #17702
  • Faster construction of the validators in Phalcon\Filter\Validation. #17697
  • Faster item storage, lookup, removal and JSON serialization in Phalcon\Support\Collection. #17683
  • Faster route index build in Phalcon\Mvc\Router for routes with no host name. #17693
  • Faster service registration in Phalcon\Factory\AbstractFactory and the factories that extend it. #17696
  • Phalcon\Mvc\Model\Query::clean() now also empties the cache of parsed PHQL statements, the same as Phalcon\Mvc\Model\Manager::__destruct(). #800

Added

  • Benchmark subjects for Acl, Cache, Config, Flash, Forms, Jwt, Logger, Security, Session and Validation in tests/benchmarks. #17695
  • Phalcon\Support\Settings support for orm.cache_level and orm.unique_cache_id. #800

Fixed

  • PHP 8.4+ builds from build/phalcon (PECL, PIE, build/install) calling the userland json_encode() and json_decode(), because config.m4 checked for HAVE_JSON, which PHP 8.4 removed. #16523
  • PHP 8.6 builds failing because PHP 8.6 removed zval_dtor(): the PHQL parser, the Volt parser and Phalcon\Mvc\Url now use zval_ptr_dtor_nogc(). #17766
  • PHP 8.6 deprecation for session handlers without create_sid(): Phalcon\Session\Adapter\AbstractAdapter and Phalcon\Session\Adapter\Noop now implement SessionIdInterface and create_sid(). #17687
  • PHP 8.6 deprecation of doubleval(): Phalcon\Encryption\Security\Uuid\Version1, Phalcon\Encryption\Security\Uuid\Version6 and Phalcon\Mvc\Model now use floatval(). #17687
  • PHP 8.6 deprecation of spl_object_hash(): Phalcon\Dispatcher\AbstractDispatcher and Phalcon\Html\Link\AbstractLinkProvider now use spl_object_id(); the keys returned by getLinks() are now integers. #17687
  • Phalcon\Acl\Adapter\Memory::addRole() and addComponent() accepting a custom RoleInterface or ComponentInterface name with the ! delimiter, which let one role, component and access tuple share the access key of another. #17800
  • Phalcon\Acl\Adapter\Memory::isAllowed() granting the access of a rule whose callback cannot be called, for example a function that does not exist or a private method. #17800
  • Phalcon\Acl\Adapter\Memory::isAllowed() not firing acl:afterCheckAccess for a role that does not exist. #17800
  • Phalcon\Acl\Adapter\Memory::isAllowed() throwing ReflectionException for a rule parameter whose class does not exist. #17800
  • Phalcon\Acl\Adapter\Storage giving an "Array to string conversion" warning for a snapshot version that is not an integer or a string. #17800
  • Phalcon\Annotations\Adapter\Stream::read() returning the content of a cache file that does not hold a Reflection object. #17773
  • Phalcon\Annotations\Adapter\Stream::write() writing the cache files with no PHP opening tag, so that a web request to a file in a folder that the web server can reach showed the serialized annotations. #17812
  • Phalcon\Annotations\Adapter\Stream using one cache file for the anonymous classes of a file whose path has no _, so that a class got the annotations of another class. #17810
  • Phalcon\Assets\Asset::getRealTargetPath() accepting a symbolic link to a file that does not exist, which let Phalcon\Assets\Manager write an asset outside the target folder. #17802
  • Phalcon\Auth\Adapter\Model::retrieveByCredentials() accepting a credential key with a newline at the end, instead of throwing InvalidCredentialKey. #17804
  • Phalcon\Auth\Internal\ContainerResolver::resolveFresh() returning the same object for a non-shared Phalcon\Di\Di service whose definition is a built object, so that two activations of an access gate could share one instance. #17806
  • Phalcon\Container\Definition\Processor\ObjectProcessor::process() setting a factory closure with no parameters, although the factory is called with the container. #17777
  • Phalcon\Contracts\Db\Adapter\Adapter::fetchColumn() and Phalcon\Db\Adapter\AbstractAdapter::fetchColumn() declaring string|bool as the return type instead of mixed. #17755
  • Phalcon\DataMapper\Pdo\Connection\AbstractConnection::__call() giving a warning and a TypeError instead of UnknownDriverMethod for a method name that is not a string. #17796
  • Phalcon\Db\Adapter\Pdo\Postgresql::describeColumns() reporting mediumblob columns as Column::TYPE_TEXT. #17724
  • Phalcon\Db\Adapter\Pdo\Postgresql::describeReferences() returning wrong column pairs for composite foreign keys. #17680
  • Phalcon\Db\Adapter\Pdo\Sqlite::describeColumns() reporting tinyint(1) columns as Column::TYPE_INTEGER. #17724
  • Phalcon\Db\Adapter\Pdo\Sqlite::describeColumns() reporting blob columns as Column::TYPE_VARCHAR. #17724
  • Phalcon\Db\Adapter\Pdo\Sqlite::describeColumns() using Column::TYPE_DECIMAL as the bind type of float columns, which stored their values as blobs. #17724
  • Phalcon\Db\Adapter\Pdo\Sqlite::describeReferences() giving null referenced columns for a foreign key with no referenced columns, which references the primary key of the referenced table. #17815
  • Phalcon\Db\Adapter\Pdo\Sqlite::describeReferences() giving one reference for each column of a composite foreign key. #17814
  • Phalcon\Db\Dialect::checkColumnType() declaring string as the return type instead of int. #17796
  • Phalcon\Db\Dialect::escapeSchema() not escaping the quote character in the schema name, which all the dialects use for the schema of a table, for example in Phalcon\Db\Dialect\Postgresql::truncateTable(). #17808
  • Phalcon\Db\Dialect\Mysql::listTables() returning MariaDB sequences and Phalcon\Db\Dialect\Postgresql::listTables() returning partitions. #17769
  • Phalcon\Db\Dialect\Mysql::truncateTable() and Phalcon\Db\Dialect\Sqlite::truncateTable() not escaping the quote character in the table and schema names. #17808
  • Phalcon\Db\Dialect\Postgresql::describeReferences() giving the name of the database as the referenced schema, instead of the schema of the referenced table. #17816
  • Phalcon\Encryption\Security::hash() passing a numeric string cost option on as a string, which gave an invalid Blowfish salt for a fractional value. #17779
  • Phalcon\Encryption\Security::hash() using the cost 4 instead of the work factor when the cost option is empty. #17764
  • Phalcon\Forms\Form::getValue() returning the tag factory for the name tagFactory. #17727
  • Phalcon\Html\Escaper\CssEscaper and Phalcon\Html\Escaper\JsEscaper declaring string as the return type of their private escape methods, which return false for the code point U+0000. #17783
  • Phalcon\Http\Request\Bag\AbstractBag::normalizeKey() declaring string as the return type instead of int|string. #17771
  • Phalcon\Image\Adapter\Imagick::processSave() returning null instead of true for a GIF file. #17788
  • Phalcon\Mvc\Model::doLowInsert() not reading back the generated id on MySQL when the identity property is 0. #17689
  • Phalcon\Mvc\Model::save() leaving the transaction of the related records open when an exception is thrown during the save; the transaction is now rolled back before the exception is thrown again. #17756
  • Phalcon\Mvc\Model\Manager::getModelSource() ignoring Source attributes when AttributesReader is configured. #17741
  • Phalcon\Mvc\Model\Query::getCache() declaring Phalcon\Db\Adapter\AdapterInterface as the return type instead of ?Phalcon\Cache\CacheInterface. #17796
  • Phalcon\Mvc\Model\Query::getIntermediate() throwing a TypeError after parse() got the intermediate representation from the cache. #800
  • Phalcon\Mvc\Model\Query\Builder::__construct() crashing with OPcache when the parameters have empty bind or bindTypes arrays. #17725
  • Phalcon\Mvc\Model\Query\Lang::parsePHQL() ignoring the orm.enable_literals and orm.cache_level values set with Phalcon\Mvc\Model::setup() or Phalcon\Support\Settings::set(). #17797
  • Phalcon\Mvc\Model\Query giving an "Undefined array key" warning for a join with no ON condition when enable_implicit_joins is disabled; the query still throws Phalcon\Db\Exceptions\InvalidSqlExpression. #816
  • Phalcon\Mvc\Model\Query reusing a cached intermediate representation that was built with the other value of the enable_implicit_joins option. #800
  • Phalcon\Mvc\Model\Resultset\Complex and Phalcon\Mvc\Model\Resultset\Simple putting their cache in the serialized data, which failed for a cache that cannot be serialized, such as a Redis connection. A resultset from the cache now has no cache (getCache() returns null). #17766
  • Phalcon\Mvc\View\Engine\Volt\Compiler::compile() rendering serialized blocks for the second child of a layout when stat is false. #17674
  • Phalcon\Mvc\View\Engine\Volt\Compiler::compileCall() silently dropping {% call %} blocks instead of throwing an exception. #17676
  • Phalcon\Mvc\View\Engine\Volt\Compiler::compileEcho() escaping the output of the escape filters (e, escape, escape_attr and others) a second time when autoescape is on. #17678
  • Phalcon\Queue\Consumer\Worker::handleSignal() throwing an ArgumentCountError when the worker receives a signal. #17719
  • Phalcon\Storage\Adapter\RedisCluster and Phalcon\Cache\Adapter\RedisCluster using a string instead of an array as the default hosts option. #17762
  • Phalcon\Support\Debug::debugVar() storing the arguments and objects of each backtrace frame. #17746
  • Phalcon\Support\Debug::onUncaughtException() discarding only one output buffer level. #17739
  • Phalcon\Support\Debug::onUncaughtException() turning a warning raised while rendering into a fatal error and echoing later exception messages without escaping. #17733
  • Phalcon\Support\Debug::setBlacklist() filtering only the top-level keys of the request and server data. #17736
  • Phalcon\Support\Debug\Dump::variable() not escaping public property names in the HTML output. #17729
  • Phalcon\Support\Debug\Dump::variable() printing the key after a skipped key on the same line. #17746
  • Phalcon\Support\Debug\Dump::variable() throwing an Error in detailed mode for typed properties that have no value. #17735
  • Phalcon\Support\Debug\Renderer\HtmlRenderer::getVarDump() to call reflection on private methods and only on objects. #17743
  • Phalcon\Support\Debug\Renderer\HtmlRenderer::render() dropping invalid UTF-8 text and not escaping quotes, class names and file paths. #17731
  • Phalcon\Support\Debug\Renderer\HtmlRenderer::render() not showing the previous exceptions, and showing files in a Windows \vendor\ folder as application code. #17746
  • Phalcon\Support\Debug\Renderer\HtmlRenderer::render() stopping the debug page for objects with a dump() method that is not public, is static, has required parameters or does not return an array. #17735
  • Phalcon\Support\Debug\ReportBuilder::build() reading a file again for each frame, and linking Phalcon classes to API pages that do not exist. #17746

Removed

  • Removed the {% cache %}/{% endcache %} Volt tag from the parser; it now raises a syntax error. #17677
  • Removed the unused mode key from the code fragment of Phalcon\Support\Debug\Report\BacktraceItem::getFragment(). #17748

Upgrade Notes

  • A callback that cannot be called (an unknown function or method, a method that is not public, or an object with no __invoke()) now throws the PHP TypeError of call_user_func() or call_user_func_array(). Before, Phalcon gave a warning and returned null. This comes from Zephir 1.9.0. It applies, for example, to the Phalcon\Di service definitions and calls, the Phalcon\Filter\Filter sanitizers, the Phalcon\Html\TagFactory and Phalcon\Support\HelperFactory helpers, the dispatcher actions, the Phalcon\Mvc\Micro handlers, the router converters and the Phalcon\Mvc\Model\Resultset::filter() callback. Code that checks for the warning or for null must catch TypeError. #17766
  • The factory closure that Phalcon\Container\Definition\Processor\ObjectProcessor::process() sets now declares one optional parameter, the container. Phalcon\Container\Definition\ServiceDefinition::buildService() already calls the factory with the container. A call with no arguments still works, and the returned object does not change. #17777
  • The PHQL parser now reads orm.enable_literals and orm.cache_level from Phalcon\Support\Settings. A value set with Phalcon\Mvc\Model::setup() (phqlLiterals) or Settings::set() now takes priority over the ini value. Before, the parser used only the ini value. With phqlLiterals set to false, a PHQL statement with a literal now throws Phalcon\Mvc\Model\Exception. #17797
  • Phalcon\Acl\Adapter\Memory::addRole() and addComponent() now throw Phalcon\Acl\Exceptions\ForbiddenDelimiter when the name of a custom RoleInterface or ComponentInterface contains !, as the Role and Component classes do. #17800
  • Phalcon\Acl\Adapter\Memory::isAllowed() now denies the access when the rule has a callback that the ACL cannot call, for example a function that does not exist or a method that is not public. Before, the ACL ignored the callback and used only the rule. Make sure that each rule callback is a closure, a public method or a function that exists. #17800
  • Phalcon\Acl\Adapter\Memory::isAllowed() now fires acl:afterCheckAccess also for a role that does not exist, with the result of the default action as granted. A listener of this event now also gets these checks. #17800
  • Phalcon\Annotations\Adapter\Stream::read() now returns false when the cache file does not hold a Phalcon\Annotations\Reflection object, for example an object of a class that is not allowed, an array, a string, an integer or null. Before, it returned that value. get() now parses the class again and writes a new cache file, the same as for a missing cache file. #17773
  • Phalcon\Annotations\Adapter\Stream::write() now puts <?php __halt_compiler(); (Stream::FILE_HEADER) at the start of each cache file, and read() removes it. read() still reads a file with no header. An earlier version cannot read the new files: clear the annotationsDir folder after a downgrade. #17812
  • Phalcon\Auth\Manager::access() now throws Phalcon\Container\Exceptions\Exception when the access gate is registered in Phalcon\Di\Di as a built object with set(), as it already did for setShared(). Register the class name or a closure instead, so that each activation gets a new gate. #17806
  • Phalcon\Cache\AbstractCache and Phalcon\Storage\Adapter\AbstractAdapter now call fireManagerEvent() only when an events manager is set. Phalcon\Acl\Adapter\Memory::isAllowed() does the same for the acl:afterCheckAccess event; the acl:beforeCheckAccess event does not change. A subclass that overrides the protected fireManagerEvent() method no longer gets these calls when no events manager is set. With an events manager, nothing changes. #17703
  • Phalcon\Config\Config::path() no longer calls has() for each key of the path. It calls has() for the full path and, for the last key, only when get() returns null and the default value is not null. A subclass of Config or of its adapters that overrides has() no longer controls the key walk. The result of path() does not change. A path through a value that is not a collection still throws an Error; its message now names get() instead of has(). #17714
  • Phalcon\Config\Config::setData() now calls validateType() only when the config has a type. A subclass of Config or of its adapters that overrides the protected validateType() method no longer gets this call when the config has no type. With a type, nothing changes. #17702
  • Phalcon\Contracts\Db\Adapter\Adapter::fetchColumn() and Phalcon\Db\Adapter\AbstractAdapter::fetchColumn() now declare mixed as the return type instead of string|bool. The returned values do not change: the method returns the value from the database driver, for example int, float, string or null, or false when the query returns no rows. A class that overrides fetchColumn() can keep the string|bool return type. #17755
  • Phalcon\Db\Adapter\Pdo\Sqlite::describeReferences() now gives one reference for each foreign key. A composite key is one reference with all its columns, in the order of the key. The name of each reference comes from the id of PRAGMA foreign_key_list (foreign_key_<id>), not from the row number. For a table with only single-column keys, the names do not change. For a table with a composite key, the names of the keys that come after it in PRAGMA foreign_key_list change, because there are fewer references. #17814
  • Phalcon\Db\Dialect::checkColumnType() now declares int as the return type instead of string, and Phalcon\Mvc\Model\Query::getCache() now declares ?Phalcon\Cache\CacheInterface instead of Phalcon\Db\Adapter\AdapterInterface. The returned values do not change: checkColumnType() returns the column type, which is an int, and getCache() returns the cache, or null before execute() runs with the cache option. A class that overrides one of these methods must declare a compatible return type (int for checkColumnType(), ?Phalcon\Cache\CacheInterface or Phalcon\Cache\CacheInterface for getCache()), or PHP raises a fatal error when it loads the class. #17796
  • Phalcon\Db\Dialect\Postgresql::describeReferences() now gives the schema of the referenced table as REFERENCED_TABLE_SCHEMA, and Phalcon\Db\Adapter\Pdo\Postgresql::describeReferences() gives it in Reference::getReferencedSchema(), for example public. Before, both gave the name of the database. Code that compares getReferencedSchema() with the name of the database must use the name of the schema. #17816
  • Phalcon\Encryption\Security::hash() now converts a numeric string cost option to an integer. A fractional value such as '5.7' becomes 5. Before, the CRYPT_BLOWFISH_A and CRYPT_BLOWFISH_X algorithms put the string in the salt ($2a$5.7$), and crypt() returned the failure string *0. Integer costs and integer strings such as '5' give the same hashes as before. #17779
  • Phalcon\Encryption\Security::hash() now uses the work factor (getWorkFactor(), default 10) when the cost option is empty (null, 0, '0', false or ''), the same as when the option is missing. Before, it used the cost 4. New hashes for these values take longer to make. checkHash() still verifies the older hashes, because each hash keeps its own cost. #17764
  • Phalcon\Flash\AbstractFlash now returns the default message template as a constant and no longer calls toInterpolate() for it. A subclass of Phalcon\Flash\Direct or Phalcon\Flash\Session that overrides the protected static toInterpolate() method gets one call for each message with automatic HTML instead of two. The output does not change. #17704
  • Phalcon\Html\Link\LinkProvider::getLinks() and Phalcon\Html\Link\EvolvableLinkProvider::getLinks() now return arrays keyed by spl_object_id() (integers) instead of spl_object_hash() (strings). Code that builds or looks up these keys with spl_object_hash() must use spl_object_id(). getLinksByRel() is not affected. #17687
  • Phalcon\Http\Request\Bag\AbstractBag::normalizeKey() now declares int|string as the return type instead of string. The returned values do not change: an int key is still returned as an int. A class that overrides normalizeKey() can keep the string return type. #17771
  • Phalcon\Mvc\Model\Manager::getModelSource() now reads the Phalcon\Annotations\Models\MetaData\Source attribute of a model class when the annotations service uses Phalcon\Annotations\AttributesReader. A model with #[Source('x')] and no setSource() now uses the table x, with the model prefix, instead of the name from its class. A Source attribute with a missing, empty or non-string table now throws Phalcon\Mvc\Model\Exception. With the default docblock reader, nothing changes. #17741
  • Phalcon\Mvc\Model\Resultset\Simple and Phalcon\Mvc\Model\Resultset\Complex no longer put their cache in the serialized data (serialize() and __serialize()). A resultset that comes from the models cache, or from unserialize(), now returns null from getCache(). Before, it returned a copy of the cache with no connection. Code that needs the cache must get the modelsCache service from the container. In data that an older version serialized, the cache entry is ignored. #17766
  • Phalcon\Mvc\Router\Route::getIndexData() now calls getCompiledHostName() only when the route has a host name. For a route with no host name, getIndexData()[3] is now null, also when a subclass overrides getCompiledHostName(). Routing does not change. #17693
  • Phalcon\Paginator\Adapter\AbstractAdapter now creates the repository in its constructor. A custom adapter that overrides __construct() must call parent::__construct(), or getRepository() throws an Error. #17750
  • Phalcon\Queue\Consumer\Worker::handleSignal() now has a second optional parameter. A subclass that overrides this method must declare handleSignal(int $signal, ?array $info = null): void, or PHP raises a fatal error when it loads the class. #17719
  • Phalcon\Session\Adapter\AbstractAdapter and Phalcon\Session\Adapter\Noop now implement SessionIdInterface with create_sid(): string. Subclasses that override create_sid() must declare the string return type. New session IDs now come from the adapter as 32 hex characters, so session.sid_length and session.sid_bits_per_character no longer apply to these adapters. Custom handlers that implement SessionHandlerInterface directly must add create_sid() and validateId() to avoid the PHP 8.6 deprecation. #17687
  • Phalcon\Support\Collection::remove() no longer calls has(), and it calls the protected processKey() method one time instead of two. A subclass that overrides has() no longer controls what remove(), __unset() and offsetUnset() do. #17683
  • Phalcon\Support\Collection::setData() now calls validateType() only when the collection has a type. A subclass that overrides the protected validateType() method no longer gets this call (also from the constructor, init(), set(), offsetSet() and __set()) when the collection has no type. With a type, nothing changes. #17683
  • Phalcon\Support\Debug now records the output buffer level when it is created. onUncaughtException() discards all the output buffers that start after that point and keeps the buffers that started before it, for example from output_buffering or zlib.output_compression in php.ini. Before, it discarded only the top buffer, also when that buffer started before Debug was created. To discard the output of your own buffers, create Debug before you start them. #17739

Don't miss a new cphalcon release

NewReleases is sending notifications on new releases.