Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b32a8cb
Update CHANGELOG
papac Jun 15, 2026
973753c
Many Bugs fixed and new methods
papac Jun 22, 2026
bcb44d9
Merge pull request #422 from bowphp/refactor/code-base
papac Jun 22, 2026
fe8dc02
Merge pull request #423 from bowphp/5.x-update-changelog
papac Jun 22, 2026
6f64ce8
Update CHANGELOG
papac Jun 22, 2026
d135998
fix(queue): add beanstalkd type error
papac Jul 15, 2026
a12d770
Merge pull request #425 from bowphp/5.x-update-changelog
papac Jul 15, 2026
cd529fd
Merge pull request #424 from bowphp/refactor/code-base
papac Jul 15, 2026
40d1fcd
Update CHANGELOG
papac Jul 15, 2026
11665be
fix(queue): add beanstalkd type error
papac Jul 15, 2026
7f388fe
Merge pull request #426 from bowphp/5.x-update-changelog
papac Jul 15, 2026
43679e2
Merge pull request #427 from bowphp/refactor/code-base
papac Jul 15, 2026
7e9ca61
Update CHANGELOG
papac Jul 15, 2026
dd5216e
try to fix
papac Jul 17, 2026
235c06c
sec(): fix many security issues
papac Jul 18, 2026
e836693
formatting
papac Jul 18, 2026
f33780d
feat(): config encrypt method to config
papac Jul 18, 2026
12ac36d
Merge pull request #428 from bowphp/5.x-update-changelog
papac Jul 27, 2026
ee6466b
Update CHANGELOG
papac Jul 15, 2026
c2cbbb0
Update CHANGELOG
papac Jul 15, 2026
f1d961a
fix(queue): fix payload deserialization
papac Aug 10, 2026
c53e282
Merge pull request #429 from bowphp/refactor/code-base
papac Sep 28, 2026
e47595d
Update CHANGELOG
papac Sep 28, 2026
0227030
Security hardening across query builder, storage, auth, mail and crypto
papac Oct 4, 2026
0249565
Merge pull request #430 from bowphp:refactor/code-base
papac Oct 4, 2026
a072199
Validator: stop crashing on native JSON input types
papac Oct 13, 2026
70a1026
Database: empty whereIn() list and pgsql emulate_prepares option
papac Oct 13, 2026
54c3216
Log and report exception traces as strings, never raw frames
papac Oct 13, 2026
3c3802c
Merge branch '5.x' into refactor/code-base
papac Oct 13, 2026
76b4b6c
Merge pull request #431 from bowphp/refactor/code-base
papac Oct 13, 2026
eee339a
CI: replace the removed MinIO images so docker compose starts again
papac Oct 13, 2026
d81da49
Merge pull request #432 from bowphp/5.x-update-changelog
papac Oct 13, 2026
a363978
Merge pull request #433 from bowphp/refactor/code-base
papac Oct 13, 2026
9a79ac8
Update CHANGELOG
papac Oct 13, 2026
6b5e966
Container: fail clearly on an unbound interface or abstract class
papac Oct 17, 2026
202fd9d
Merge pull request #434 from bowphp/5.x-update-changelog
papac Oct 17, 2026
ae6c38a
Merge pull request #435 from bowphp/refactor/code-base
papac Oct 17, 2026
0e20b86
Update CHANGELOG
papac Oct 17, 2026
3e1390a
Merge branch 'main' into 5.x-update-changelog
papac Nov 10, 2026
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
13 changes: 10 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,17 @@ jobs:
sleep 2
done

- name: Wait for MinIO bucket initialization
- name: Wait for the MinIO test bucket
run: |
echo "Waiting for MinIO bucket initialization..."
docker wait bowphp_minio_init || true
echo "Waiting for the public 'tests' bucket on MinIO..."
for i in {1..30}; do
if [ "$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:9000/tests/)" = "200" ]; then
echo "MinIO bucket is ready!"
break
fi
echo "Waiting for MinIO... ($i/30)"
sleep 2
done

- name: Cache Composer packages
id: composer-cache
Expand Down
74 changes: 74 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,73 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 5.4.16 - 2026-10-17

### What's Changed

* Update CHANGELOG by @papac in https://github.com/bowphp/framework/pull/434
* Container: fail clearly on an unbound interface or abstract class by @papac in https://github.com/bowphp/framework/pull/435

**Full Changelog**: https://github.com/bowphp/framework/compare/5.4.15...5.4.16

## 5.4.15 - 2026-10-13

### What's Changed

* Validator JSON types, empty whereIn, pgsql emulate_prepares, string traces by @papac in https://github.com/bowphp/framework/pull/431
* Update CHANGELOG by @papac in https://github.com/bowphp/framework/pull/432
* CI: replace the removed MinIO images so docker compose starts again by @papac in https://github.com/bowphp/framework/pull/433

**Full Changelog**: https://github.com/bowphp/framework/compare/5.4.14...5.4.15

## 5.4.13 - 2026-09-28

### What's Changed

* Update CHANGELOG by @papac in https://github.com/bowphp/framework/pull/428
* fix(queue): Return value must be of type Bow\Queue\QueueTask, __PHP_Incomplete_Class returned by @papac in https://github.com/bowphp/framework/pull/429

**Full Changelog**: https://github.com/bowphp/framework/compare/5.4.12...5.4.13

## 5.4.12 - 2026-07-15

### What's Changed

* Update CHANGELOG by @papac in https://github.com/bowphp/framework/pull/426
* fix(queue): add beanstalkd type error by @papac in https://github.com/bowphp/framework/pull/427

**Full Changelog**: https://github.com/bowphp/framework/compare/5.4.11...5.4.12

## 5.4.11 - 2026-07-15

### What's Changed

* Update CHANGELOG by @papac in https://github.com/bowphp/framework/pull/425
* fix(queue): add beanstalkd type error by @papac in https://github.com/bowphp/framework/pull/424

**Full Changelog**: https://github.com/bowphp/framework/compare/5.4.10...5.4.11

## 5.4.10 - 2026-06-22

### What's Changed

* Many Bugs fixed and new methods by @papac in https://github.com/bowphp/framework/pull/422
* Update CHANGELOG by @papac in https://github.com/bowphp/framework/pull/423

**Full Changelog**: https://github.com/bowphp/framework/compare/5.4.0...5.4.10

## 5.4.0 - 2026-06-15

### What's Changed

* Update CHANGELOG by @papac in https://github.com/bowphp/framework/pull/416
* refactor(console): add index to stub models by @papac in https://github.com/bowphp/framework/pull/418
* fix(database): fix hasMany and hosOne relations by @papac in https://github.com/bowphp/framework/pull/419
* fix(cache): fix database cache by @papac in https://github.com/bowphp/framework/pull/420
* fix(session): fix database adaptor by @papac in https://github.com/bowphp/framework/pull/421

**Full Changelog**: https://github.com/bowphp/framework/compare/5.3.40...5.4.0

## 5.3.40 - 2026-06-10

### What's Changed
Expand Down Expand Up @@ -334,6 +401,13 @@ Database::transaction(fn() => $user->update(['name' => '']));













Expand Down
22 changes: 11 additions & 11 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,18 @@ Highlights from the latest iterations — already merged into `5.x`. Full detail

| Task | Status | Priority | Notes |
| ---------------------------------------------------------------- | ------ | -------- | ---------------------------------------------------------------- |
| Fix middleware attribute test (shared state between tests) | ✅ Done | - | `Router::$routes` converted to instance state |
| Fix middleware attribute test (shared state between tests) | ✅ Done | - | `Router::$routes` converted to instance state |
| Fix Pagination tests calling `total()` instead of `totalPages()` | ✅ Done | - | 24 tests fixed |
| Fix Barry model `array` cast returning `stdClass` | ✅ Done | - | `Model::executeDataCasting` + `parseToJson($value, assoc: true)` |
| Fix Validator `nullable\|required` priority | ✅ Done | - | `nullable` no longer short-circuits `required` |
| Fix `EnvTest` singleton pollution between tests | ✅ Done | - | `Env::reset()` added |
| Fix `SchedulerCommand` (`routes/scheduler.php` loading) | ✅ Done | - | `loadSchedulerFile()` updated, tolerates missing Loader |
| Remove dead `Model::$soft_delete` property | ✅ Done | - | Replaced with a fully functional trait |
| Improve `addEnum` / `changeEnum` error messages | ✅ Done | - | Explicitly mention the `size` key |
| Standardize method signatures | ✅ Done | - | PHP 8.1+ nullable types |
| Fix `(double)` → `(float)` cast | ✅ Done | - | `Model.php` |
| Handle `array_key_exists` with null key | ✅ Done | - | `Console.php` |
| Create test directory if missing | ✅ Done | - | `CustomCommand.php` |
| Fix Barry model `array` cast returning `stdClass` | ✅ Done | - | `Model::executeDataCasting` + `parseToJson($value, assoc: true)`|
| Fix Validator `nullable\|required` priority | ✅ Done | - | `nullable` no longer short-circuits `required` |
| Fix `EnvTest` singleton pollution between tests | ✅ Done | - | `Env::reset()` added |
| Fix `SchedulerCommand` (`routes/scheduler.php` loading) | ✅ Done | - | `loadSchedulerFile()` updated, tolerates missing Loader |
| Remove dead `Model::$soft_delete` property | ✅ Done | - | Replaced with a fully functional trait |
| Improve `addEnum` / `changeEnum` error messages | ✅ Done | - | Explicitly mention the `size` key |
| Standardize method signatures | ✅ Done | - | PHP 8.1+ nullable types |
| Fix `(double)` → `(float)` cast | ✅ Done | - | `Model.php` |
| Handle `array_key_exists` with null key | ✅ Done | - | `Console.php` |
| Create test directory if missing | ✅ Done | - | `CustomCommand.php` |

### Documentation

Expand Down
27 changes: 9 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,37 +146,28 @@ services:
retries: 5
minio:
container_name: bowphp_minio
image: minio/minio
# MinIO removed its images from Docker Hub (minio/minio and minio/mc
# now return "object not found") and quay.io requires a login, which
# broke `docker compose up` in CI. Bitnami's frozen legacy archive is
# the drop-in: same API and ports, and it creates the test bucket
# itself through MINIO_DEFAULT_BUCKETS, so no `mc` init container.
image: bitnamilegacy/minio:latest
restart: unless-stopped
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
command: server /data --console-address ":9001"
# bucket:policy — a public "tests" bucket, as minio-init used to create.
MINIO_DEFAULT_BUCKETS: "tests:public"
networks:
- bowphp_network
healthcheck:
test: ["CMD", "mc", "alias", "set", "local", "http://localhost:9000", "minioadmin", "minioadmin"]
test: ["CMD", "curl", "-sf", "http://localhost:9000/minio/health/ready"]
interval: 10s
timeout: 5s
retries: 5
minio-init:
container_name: bowphp_minio_init
image: minio/mc
depends_on:
minio:
condition: service_healthy
entrypoint: >
/bin/sh -c "
mc alias set local http://minio:9000 minioadmin minioadmin;
mc mb --ignore-existing local/tests;
mc anonymous set public local/tests;
exit 0;
"
networks:
- bowphp_network
zookeeper:
container_name: bowphp_zookeeper
image: confluentinc/cp-zookeeper:7.5.0
Expand Down
21 changes: 19 additions & 2 deletions src/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@ public function run(): bool

$this->router->setPrefix('');

// Raised here rather than from Request::capture(), which runs during
// this class's constructor — too early for the container or the error
// handler to turn it into a response. By now both are up, so a bad
// payload is a rendered 400 instead of an uncaught PHP fatal.
$invalid_json_payload = $this->request->getInvalidJsonPayload();

if (!is_null($invalid_json_payload)) {
throw new BadRequestException(
"The request json payload is invalid: " . $invalid_json_payload,
);
}

$method = $this->request->method();

// We verify the existence of the method of the request in
Expand Down Expand Up @@ -213,12 +225,17 @@ public function send(): bool
* @param int $code
* @return void
*/
private function sendResponse(mixed $response, int $code = 200): void
private function sendResponse(mixed $response, ?int $code = null): void
{
if ($response instanceof ResponseInterface) {
$response->sendContent();
} else {
echo $this->response->send($response, $code);
// Carry the status the response already holds. A controller that
// returned response()->json($data, 404) has set it on this very
// instance, and passing a hardcoded 200 here overwrote it — every
// json() error answered 200 with an error body, so clients could
// not tell success from failure.
echo $this->response->send($response, $code ?? $this->response->getCode());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/BaseErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function json($exception, mixed $code = null): void
}

if (app_env("APP_ENV") != "production") {
$response["trace"] = $exception->getTrace();
$response["trace"] = $exception->getTraceAsString();
}

response()->status($status);
Expand Down
8 changes: 8 additions & 0 deletions src/Auth/Guards/SessionGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function attempts(array $credentials, bool $remember = false): bool
$password = $credentials[$fields['password']];

if (Hash::check($password, $user->{$fields['password']})) {
// Rotate the session ID on privilege elevation (anti session
// fixation). regenerate() preserves data, so the stored user below
// lives under the new ID.
$this->getSession()->regenerate();
$this->getSession()->put($this->session_key, $user);

if ($remember) {
Expand Down Expand Up @@ -127,6 +131,10 @@ public function guest(): bool
*/
public function login(Authentication $user, bool $remember = false): bool
{
// Rotate the session ID on privilege elevation (anti session fixation).
// regenerate() preserves data, so the stored user below lives under the
// new ID.
$this->getSession()->regenerate();
$this->getSession()->add($this->session_key, $user);

if ($remember) {
Expand Down
9 changes: 8 additions & 1 deletion src/Configuration/LoggerConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ private function loadFrontLogger(Logger $monolog, $error_handler): void

$handler = new CallbackHandler(
function ($exception, $inspector, $run) use ($monolog, $error_handler) {
$monolog->error($exception->getMessage(), $exception->getTrace());
$monolog->error($exception->getMessage(), [
'exception' => $exception::class,
'file' => $exception->getFile() . ':' . $exception->getLine(),
// A string trace: never serialize the frame args, which may
// hold objects whose jsonSerialize() runs a query (and would
// throw here on an already-aborted transaction).
'trace' => $exception->getTraceAsString(),
]);

$result = call_user_func_array([new $error_handler(), 'handle'], [$exception]);

Expand Down
10 changes: 8 additions & 2 deletions src/Container/Capsule.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Bow\Container;

use ArrayAccess;
use Bow\Container\Exception\ContainerException;
use Closure;
use InvalidArgumentException;
use ReflectionClass;
Expand Down Expand Up @@ -86,14 +87,19 @@ public function makeWith(string $key, array $parameters = []): mixed
*
* @param string $key
* @return mixed
* @throws
* @throws ContainerException when $key is an interface or abstract class without a binding
* @throws \ReflectionException when $key is not a class at all
*/
private function resolve(string $key): mixed
{
$reflection = new ReflectionClass($key);

// An interface or abstract class with no binding cannot be built.
// Returning the key here handed a *string* to every caller expecting
// an instance, which surfaced far away as a TypeError in the
// controller injector. Fail here, naming the missing binding.
if (!$reflection->isInstantiable()) {
return $key;
throw ContainerException::notInstantiable($key);
}

$constructor = $reflection->getConstructor();
Expand Down
33 changes: 33 additions & 0 deletions src/Container/Exception/ContainerException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Bow\Container\Exception;

use RuntimeException;

/**
* Raised when the container cannot build a dependency.
*/
class ContainerException extends RuntimeException
{
/**
* The key asked of the container could not be turned into an instance
* because it is an interface or an abstract class with no binding.
*
* @param string $key
* @return ContainerException
*/
public static function notInstantiable(string $key): ContainerException
{
$kind = interface_exists($key) ? 'interface' : 'abstract class';

return new static(sprintf(
'Cannot resolve [%s]: it is an %s and no binding is registered for it. '
. 'Bind a concrete implementation, for example app()->bind(%s::class, Concrete::class).',
$key,
$kind,
$key
));
}
}
6 changes: 3 additions & 3 deletions src/Database/Connection/AbstractConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ abstract class AbstractConnection
*
* @param array $config
*/
public function __construct(array $config)
public function __construct(#[\SensitiveParameter] array $config)
{
$this->config = $config;

Expand Down Expand Up @@ -95,15 +95,15 @@ public function __construct(array $config)
* @param array $config
* @return void
*/
abstract protected function validateConfig(array $config): void;
abstract protected function validateConfig(#[\SensitiveParameter] array $config): void;

/**
* Build a PDO instance from the given configuration.
*
* @param array $config
* @return PDO
*/
abstract protected function makePdo(array $config): PDO;
abstract protected function makePdo(#[\SensitiveParameter] array $config): PDO;

/**
* Build (eagerly) the write connection.
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Connection/Adapters/MysqlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MysqlAdapter extends AbstractConnection
* @param array $config
* @return void
*/
protected function validateConfig(array $config): void
protected function validateConfig(#[\SensitiveParameter] array $config): void
{
// Check the existence of database definition
if (!isset($config['database'])) {
Expand All @@ -44,7 +44,7 @@ protected function validateConfig(array $config): void
* @param array $config
* @return PDO
*/
protected function makePdo(array $config): PDO
protected function makePdo(#[\SensitiveParameter] array $config): PDO
{
// Build of the mysql dsn
if (isset($config['socket']) && !empty($config['socket'])) {
Expand Down
Loading
Loading