safe icon indicating copy to clipboard operation
safe copied to clipboard

All PHP functions, rewritten to throw exceptions instead of returning false

Results 109 safe issues
Sort by recently updated
recently updated
newest added

Starting with PHP 8.0 the GdImage class objects replace GD image resources: https://php.watch/versions/8.0/gdimage Will open a PR later.

# Environment **PHP version:** 8.1.28 **PHPStan version:** 1.11.1 **Safe version:** 2.5.0 **PHPStan Safe Rule version:** 1.2.0 # Description of problem When creating a constant using the `Safe\define()` function, and the...

enhancement

There doesn't seem to be a Safe implementation of [get_cfg_var()](https://www.php.net/manual/en/function.get-cfg-var.php), which returns the config value as string or array on success, but boolean FALSE on error.

- Added php 8.2 and 8.3 support - Bumped minimum version to php 8.2 - Added more code quality tools: phpcs, phpstan, rector - Added support for phpunit 10 and...

If the zip archive contains an empty file, the `getFromIndex()` function in the safe library throws an exception. Exception message states "Failed to extract file from the zip archive: No...

enhancement

I'm currently refactoring a large code base. I'm using rector and this wonderful library to make it safer :-) I stumbled upon `shuffle` and wonder: why? In which circumstances does...

It looks like there is not much activity here, so I would offer my help to maintain this repository. Cheers, Oskar cc @mvhirsch @igst @silasjoisten @localheinz @staabm

Look like `openssl_random_pseudo_bytes` is not implemented as `Safe\`-variant. Could we add this one, please? https://www.php.net/manual/en/function.openssl-random-pseudo-bytes.php

This handles a rather unpleasant quirk in PHP where if `json_decode` is called without `JSON_THROW_ON_ERROR_FLAG` for an invalid json string before calling `json_decode` for a valid json string with said...

![CleanShot 2025-05-15 at 14 12 45@2x](https://github.com/user-attachments/assets/b7135e8c-37cc-41e7-9435-e511a90fbd84) ![CleanShot 2025-05-15 at 14 14 06@2x](https://github.com/user-attachments/assets/0c509b3f-c84b-4df6-8717-6b931565efcb)