• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

umbrellio / laravel-pg-extensions / 15429247403

03 Jun 2025 10:36PM UTC coverage: 99.624% (-0.4%) from 100.0%
15429247403

push

github

web-flow
added sanitize (#97)

5 of 6 new or added lines in 2 files covered. (83.33%)

265 of 266 relevant lines covered (99.62%)

21.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/Helpers/PostgresTextSanitizer.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Umbrellio\Postgres\Helpers;
6

7
class PostgresTextSanitizer
8
{
9
    /**
10
     * Удаляет запрещённые/опасные символы из строки для PostgreSQL.
11
     *
12
     * Удаляются:
13
     * - \x00 (нулевой байт)
14
     * - управляющие символы ASCII от \x01 до \x1F, кроме \x09, \x0A, \x0D
15
     */
16
    public static function sanitize(?string $input): ?string
17
    {
18
        if ($input === null) {
6✔
NEW
19
            return null;
×
20
        }
21

22
        // Удаляем управляющие символы, кроме: табуляция (\x09), \n (\x0A), \r (\x0D)
23
        $input = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/u', '', $input);
6✔
24

25
        return $input;
6✔
26
    }
27
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc