File: php82_suppress_dynamic_properties_warning.inc

package info (click to toggle)
php-igbinary 3.2.16-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,024 kB
  • sloc: ansic: 3,373; xml: 1,106; pascal: 10; makefile: 2; php: 2; sh: 1
file content (20 lines) | stat: -rw-r--r-- 677 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
if (PHP_VERSION_ID < 80200) {
    return;
}
$totalErrors = 0;
function igbinary_suppress_dynamic_properties_warning($errno, $errstr): bool {
    if ($errno === E_DEPRECATED && str_contains($errstr, 'Creation of dynamic property')) {
        $GLOBALS['totalErrors']++;
        return true;
    }
    return false;
}
set_error_handler('igbinary_suppress_dynamic_properties_warning');

function igbinary_expect_warn_dynamic_properties(): void {
    if ($GLOBALS['totalErrors'] < 1) {
        echo "Expected this test to have at least one warning about creating dynamic properties in php 8.2\n";
    }
}
register_shutdown_function('igbinary_expect_warn_dynamic_properties');