What's New in Laravel 13.27: Key Features | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Query Binding Masking and whereBinary() in Laravel 13.27        On this page       1. [  What's New in Laravel 13.27 ](#whats-new-in-laravel-1327)
2. [  Masking Query Bindings in Exception Messages ](#masking-query-bindings-in-exception-messages)
3. [  whereBinary() for Case-Sensitive Comparisons ](#codewherebinarycode-for-case-sensitive-comparisons)
4. [  refreshForUpdate() for Pessimistic Locking ](#coderefreshforupdatecode-for-pessimistic-locking)
5. [  Cloud Facade ](#codecloudcode-facade)
6. [  Queue Size Totals ](#queue-size-totals)
7. [  Other Notable Changes ](#other-notable-changes)
8. [  Key Takeaways ](#key-takeaways)

  ![Query Binding Masking and whereBinary() in Laravel 13.27](https://cdn.msaied.com/597/bd82bbbaee7d7826a7a3a2f4e8b77330.png)

 [  Laravel ](https://msaied.com/articles?category=laravel)  #Laravel 13.27   #Eloquent   #Query Builder   #Security   #Releases  

 Query Binding Masking and whereBinary() in Laravel 13.27 
==========================================================

     26 Aug 2026      4 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   What's New in Laravel 13.27  ](#whats-new-in-laravel-1327)
2. [  02   Masking Query Bindings in Exception Messages  ](#masking-query-bindings-in-exception-messages)
3. [  03   whereBinary() for Case-Sensitive Comparisons  ](#codewherebinarycode-for-case-sensitive-comparisons)
4. [  04   refreshForUpdate() for Pessimistic Locking  ](#coderefreshforupdatecode-for-pessimistic-locking)
5. [  05   Cloud Facade  ](#codecloudcode-facade)
6. [  06   Queue Size Totals  ](#queue-size-totals)
7. [  07   Other Notable Changes  ](#other-notable-changes)
8. [  08   Key Takeaways  ](#key-takeaways)

 What's New in Laravel 13.27
---------------------------

Laravel 13.27 was released on August 26, 2026, bringing several developer-quality-of-life improvements alongside meaningful security and correctness fixes. Here is a breakdown of the most important changes.

---

### Masking Query Bindings in Exception Messages

By default, `QueryException` interpolates bound values directly into its message. That means a failed `INSERT` can expose email addresses, names, or other sensitive data in log files, APM spans, and the `failed_jobs` table.

A new per-connection config key stops the interpolation:

```php
'mysql' => [
    'driver' => 'mysql',
    // ...
    'mask_bindings_in_exception_messages' => env('DB_MASK_BINDINGS', false),
],

```

With masking enabled, the exception message retains `?` placeholders instead of real values. `getBindings()` is unaffected, so debugging tooling that reads bindings directly still works. Applications that never published `config/database.php` can enable the feature with a single environment variable: `DB_MASK_BINDINGS=true`.

---

### `whereBinary()` for Case-Sensitive Comparisons

MySQL's default collations are case-insensitive, so `where('name', 'John')` also matches `john` and `JOHN`. Previously, a byte-exact comparison required raw SQL:

```php
DB::table('queues')->whereRaw('name = BINARY ?', [$queueName])->first();

```

Laravel 13.27 adds a full family of query builder methods:

```php
DB::table('queues')->whereBinary('name', $queueName)->first();
// select * from `queues` where `name` = binary ?

DB::table('queues')->whereNotBinary('name', $queueName)->get();
// select * from `queues` where `name` != binary ?

```

The family includes `orWhereBinary()` and `orWhereNotBinary()`. MariaDB inherits the MySQL grammar and works automatically. Postgres, SQLite, and SQL Server throw a `RuntimeException`, consistent with how `whereLike()` handles engines that are already case-sensitive.

---

### `refreshForUpdate()` for Pessimistic Locking

Models resolved before a transaction starts — through route model binding or a job payload — need to be re-queried under a lock before writing. The old pattern discarded the existing instance:

```php
DB::transaction(function () use ($product) {
    $product = Product::query()->lockForUpdate()->findOrFail($product->getKey());
    $product->decrement('stock');
});

```

The new `refreshForUpdate()` method refreshes the instance in place:

```php
DB::transaction(function () use ($product) {
    $product->refreshForUpdate();

    if ($product->stock === 0) {
        throw new RuntimeException('The product is out of stock.');
    }

    $product->decrement('stock');
});

```

The lock only holds for the life of the transaction, so the call must be made inside one.

---

### `Cloud` Facade

A new `Cloud` facade consolidates Laravel Cloud environment checks into three methods:

```php
use Illuminate\Support\Facades\Cloud;

Cloud::hosted();            // running on Laravel Cloud?
Cloud::usesManagedQueues(); // is the cloud queue connection configured?
Cloud::queue();             // the managed queue connection itself

```

`Cloud::queue()` throws a `RuntimeException` when managed queues are not configured, so pair it with `usesManagedQueues()`. The facade is not registered in the default aliases to avoid collisions with existing application classes.

---

### Queue Size Totals

Three new methods sum queue sizes across every queue a connection knows about, without decoding job payloads:

```php
Queue::totalPendingSize();
Queue::totalDelayedSize();
Queue::totalReservedSize();

```

Implemented for the Redis, database, failover, and fake drivers.

---

### Other Notable Changes

- **Vector distance queries** now work on MariaDB 11.7+ via `vec_distance_cosine()`.
- **Validation hardening**: `in_array` and `doesnt_contain` rules now use strict comparison, preventing scientific-notation string matches like `"1e0"` matching `"1"`.
- **`Request::merge(['*' => value])`** no longer wipes the entire input array; `*` is now stored literally.
- **`MaintenanceModeBypassCookie::isValid()`** now checks `is_string()` on the `mac` field, preventing a malformed cookie from causing a 500 error.
- **Postgres keepalive DSN options** prevent idle firewall timeouts from silently killing long-lived worker connections.
- **SQS credential caching** reduces AWS credential fetches to one per rotation instead of one per PHP-FPM worker.

---

### Key Takeaways

- Enable `DB_MASK_BINDINGS=true` to keep sensitive values out of exception messages and logs.
- Replace `whereRaw('name = BINARY ?', [...])` with `whereBinary('name', ...)` for cleaner, driver-aware code.
- Use `refreshForUpdate()` inside transactions to simplify pessimistic locking on already-resolved models.
- The `Cloud` facade provides a clean API for Laravel Cloud environment detection.
- Strict comparison fixes in validation rules close subtle type-juggling edge cases.

---

*Source: [Laravel News — Laravel 13.27.0](https://laravel-news.com/laravel-13-27-0)*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fquery-binding-masking-and-wherebinary-in-laravel-1327&text=Query+Binding+Masking+and+whereBinary%28%29+in+Laravel+13.27) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fquery-binding-masking-and-wherebinary-in-laravel-1327) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  Does enabling `mask\_bindings\_in\_exception\_messages` affect what `getBindings()` returns?        No. Only the exception message changes — `?` placeholders replace the interpolated values. `getBindings()` still returns the actual bound values, so debugging tools that read bindings directly are unaffected. 

      Q02  Which database drivers support the new `whereBinary()` methods?        `whereBinary()` and its variants work on MySQL and MariaDB. Calling them on Postgres, SQLite, or SQL Server throws a `RuntimeException`, consistent with how `whereLike()` handles those engines. 

      Q03  When should I use `refreshForUpdate()` instead of `refresh()`?        Use `refreshForUpdate()` inside a database transaction when you need a pessimistic lock on a model that was resolved before the transaction started (e.g., via route model binding or a job payload). It reloads the model with `lockForUpdate()` applied, closing the data race between reading and writing. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://msaied.com/articles) 

 [ ![Multi-Tenant SaaS with Laravel: Isolating Tenant Data Using Row-Level Scoping](https://cdn.msaied.com/594/c38a3d613735b3f43e77683aeb0cce84.png) laravel multi-tenancy saas 

### Multi-Tenant SaaS with Laravel: Isolating Tenant Data Using Row-Level Scoping

Row-level multi-tenancy keeps your schema simple but demands discipline. Learn how to enforce tenant isolation...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 26 Aug 2026     3 min read  

  Read    

 ](https://msaied.com/articles/multi-tenant-saas-with-laravel-isolating-tenant-data-using-row-level-scoping) [ ![Laravel Boost v2.6.0: Testing Best Practices Skill and Read-Only DB Transactions](https://cdn.msaied.com/595/80a42be71329f6ac99af4be159b7497d.png) Laravel Boost Testing MCP 

### Laravel Boost v2.6.0: Testing Best Practices Skill and Read-Only DB Transactions

Laravel Boost v2.6.0 ships a unified testing-best-practices skill for AI coding agents, database-enforced read...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 26 Aug 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-boost-v260-testing-best-practices-skill-and-read-only-db-transactions) [ ![Laravel Auditor: AI-Powered Code Auditing for Laravel Applications](https://cdn.msaied.com/593/e1204fbf1f19082d6afc53717375ca16.png) Laravel AI Code Auditing 

### Laravel Auditor: AI-Powered Code Auditing for Laravel Applications

Laravel Auditor gives your existing AI agent a written audit methodology, 75 stable rules, and read-only proje...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 24 Aug 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-auditor-ai-powered-code-auditing-for-laravel-applications) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
