<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/query-binding-masking-and-wherebinary-in-laravel-13-27-cjmmnmpzq" -->

---
title: Query Binding Masking and whereBinary() in Laravel 13.27
description: Laravel 13.27 introduces a per-connection setting that masks query bindings out of exception messages, preventing sensitive data like emails from leaking into...
canonical: https://daily.dev/posts/query-binding-masking-and-wherebinary-in-laravel-13-27-cjmmnmpzq
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Query Binding Masking and whereBinary() in Laravel 13.27 | daily.dev
og:description: Laravel 13.27 introduces a per-connection setting that masks query bindings out of exception messages, preventing sensitive data like emails from leaking into...
og:url: https://daily.dev/posts/query-binding-masking-and-wherebinary-in-laravel-13-27-cjmmnmpzq
og:image: https://api.daily.dev/og/posts/cJmMNMpZQ.png
og:image:alt: Query Binding Masking and whereBinary() in Laravel 13.27
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Binding Masking and whereBinary() in Laravel 13.27

**[Laravel News](https://daily.dev/sources/ln)** · 8 min read · 7 upvotes · 0 comments

## Summary

Laravel 13.27 introduces a per-connection setting that masks query bindings out of exception messages, preventing sensitive data like emails from leaking into logs and APM spans. It adds a whereBinary() family for byte-exact, case-sensitive comparisons on MySQL and MariaDB, plus refreshForUpdate() to reload an Eloquent model under a pessimistic lock without re-querying by primary key. Other additions include a Cloud facade for Laravel Cloud checks, queue total-size methods across all queues, MariaDB support for vector distance queries, Postgres keepalive DSN options, shared AWS credential caching for SQS, and several input-handling and validation-hardening fixes.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://laravel-news.com/laravel-13-27-0>

## Questions this post answers

### How do I stop Laravel from leaking query bindings like email addresses into exception messages and logs?

Set the new mask_bindings_in_exception_messages option to true on a database connection in Laravel 13.27, or set DB_MASK_BINDINGS=true even without publishing config/database.php. This leaves ? placeholders in QueryException messages instead of interpolating actual bound values, so failed_jobs entries, log files, and APM spans no longer expose sensitive data. getBindings() still returns the real values.

_Developers hardening logging pipelines can track framework changes like this via daily.dev before they ship to production._

### How do I do a case-sensitive, byte-exact WHERE comparison in Laravel without writing raw SQL?

Use the new whereBinary() method added in Laravel 13.27, along with orWhereBinary(), whereNotBinary(), and orWhereNotBinary(). These compile to a BINARY comparison on MySQL and MariaDB, replacing whereRaw('name = BINARY ?', [$value]). Postgres, SQLite, and SQL Server throw a RuntimeException since they already compare case sensitively by default.

_Anyone comparing database engines for case-sensitive lookups can follow Laravel query-builder updates on daily.dev._

### How can I take a pessimistic lock on an Eloquent model I already loaded, without re-querying it by primary key inside a transaction?

Call the new refreshForUpdate() method introduced in Laravel 13.27, which behaves like refresh() but applies lockForUpdate() to the reload query. This refreshes the existing model instance in place with a row lock held for the rest of the transaction, avoiding the previous pattern of discarding the instance and re-fetching via Product::query()->lockForUpdate()->findOrFail().

_Backend engineers dealing with data races on writes can keep up with Eloquent locking changes through daily.dev._

## Similar posts on daily.dev

- [Mask Query Bindings in Laravel Exception Messages](https://daily.dev/posts/mask-query-bindings-in-laravel-exception-messages-0b2mdx6ak) · Laravel News · 4 upvotes · 0 comments
- [whereBinary\(\): Case-Sensitive MySQL Queries in Laravel](https://daily.dev/posts/wherebinary-case-sensitive-mysql-queries-in-laravel-9q7j7mxvl) · Laravel News · 12 upvotes · 0 comments
- [Laravel 13 now supports MariaDB Vector natively](https://daily.dev/posts/laravel-13-now-supports-mariadb-vector-natively-moxv4b4ls) · MariaDB.org · 10 upvotes · 0 comments
- [Query Builder Expression Aliases in Laravel 12.48](https://daily.dev/posts/query-builder-expression-aliases-in-laravel-12-48-hochgcfjt) · Laravel News · 13 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel), [#mysql](https://daily.dev/tags/mysql)

[View this post on daily.dev](https://daily.dev/posts/query-binding-masking-and-wherebinary-in-laravel-13-27-cjmmnmpzq)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Query Binding Masking and whereBinary() in Laravel 13.27","url":"https://daily.dev/posts/query-binding-masking-and-wherebinary-in-laravel-13-27-cjmmnmpzq","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/query-binding-masking-and-wherebinary-in-laravel-13-27-cjmmnmpzq"},"datePublished":"2026-08-26T13:59:12.953Z","dateModified":"2026-09-14T09:22:20.520Z","description":"Laravel 13.27 introduces a per-connection setting that masks query bindings out of exception messages, preventing sensitive data like emails from leaking into...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ee40e2048594e45913dd31bd66f36e1c?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ee40e2048594e45913dd31bd66f36e1c?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Laravel News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Laravel News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/ln","url":"https://daily.dev/sources/ln"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/query-binding-masking-and-wherebinary-in-laravel-13-27-cjmmnmpzq","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":7},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"php,laravel,mysql","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Laravel News","item":"https://daily.dev/sources/ln"},{"@type":"ListItem","position":3,"name":"Query Binding Masking and whereBinary() in Laravel 13.27"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/query-binding-masking-and-wherebinary-in-laravel-13-27-cjmmnmpzq#faq","mainEntity":[{"@type":"Question","name":"How do I stop Laravel from leaking query bindings like email addresses into exception messages and logs?","acceptedAnswer":{"@type":"Answer","text":"Set the new mask_bindings_in_exception_messages option to true on a database connection in Laravel 13.27, or set DB_MASK_BINDINGS=true even without publishing config/database.php. This leaves ? placeholders in QueryException messages instead of interpolating actual bound values, so failed_jobs entries, log files, and APM spans no longer expose sensitive data. getBindings() still returns the real values. Developers hardening logging pipelines can track framework changes like this via daily.dev before they ship to production."}},{"@type":"Question","name":"How do I do a case-sensitive, byte-exact WHERE comparison in Laravel without writing raw SQL?","acceptedAnswer":{"@type":"Answer","text":"Use the new whereBinary() method added in Laravel 13.27, along with orWhereBinary(), whereNotBinary(), and orWhereNotBinary(). These compile to a BINARY comparison on MySQL and MariaDB, replacing whereRaw('name = BINARY ?', [$value]). Postgres, SQLite, and SQL Server throw a RuntimeException since they already compare case sensitively by default. Anyone comparing database engines for case-sensitive lookups can follow Laravel query-builder updates on daily.dev."}},{"@type":"Question","name":"How can I take a pessimistic lock on an Eloquent model I already loaded, without re-querying it by primary key inside a transaction?","acceptedAnswer":{"@type":"Answer","text":"Call the new refreshForUpdate() method introduced in Laravel 13.27, which behaves like refresh() but applies lockForUpdate() to the reload query. This refreshes the existing model instance in place with a row lock held for the rest of the transaction, avoiding the previous pattern of discarding the instance and re-fetching via Product::query()-\u003elockForUpdate()-\u003efindOrFail(). Backend engineers dealing with data races on writes can keep up with Eloquent locking changes through daily.dev."}}]}
```

