From 32630bde22957a9c9a18c4ccdb4df2523f83b0ca Mon Sep 17 00:00:00 2001 From: "n[oO]ne" Date: Fri, 24 May 2024 12:00:14 +0700 Subject: [PATCH] [#16593] - fix: fixed memory leak by anonymous function in PascalCase.zep --- CHANGELOG-5.0.md | 12 ++++++++++++ phalcon/Support/Helper/Str/PascalCase.zep | 14 ++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index eb2f9587e6f..338b64e9c81 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -1,5 +1,17 @@ # Changelog +## [5.7.1](https://github.com/phalcon/cphalcon/releases/tag/v5.7.1) (XXXX-XX-XX) + +### Changed + +### Added + +### Fixed + +- Fixed `Phalcon\Support\Helper\PascalCase` causing memory leak by anonymous function [#16593](https://github.com/phalcon/cphalcon/issues/16593) + +### Removed + ## [5.7.0](https://github.com/phalcon/cphalcon/releases/tag/v5.7.0) (2024-05-17) ### Changed diff --git a/phalcon/Support/Helper/Str/PascalCase.zep b/phalcon/Support/Helper/Str/PascalCase.zep index a11e5649007..826113183de 100644 --- a/phalcon/Support/Helper/Str/PascalCase.zep +++ b/phalcon/Support/Helper/Str/PascalCase.zep @@ -25,18 +25,16 @@ class PascalCase string text, string delimiters = null ) -> string { - var exploded, output; + var exploded, output, element; let exploded = this->processArray(text, delimiters); - let output = array_map( - function (element) { - return ucfirst(mb_strtolower(element)); - }, - exploded - ); + let output = ""; + for element in exploded { + let output = output . ucfirst(mb_strtolower(element)); + } - return implode("", output); + return output; } /**