Skip to content

Instantly share code, notes, and snippets.

@mmcev106
mmcev106 / MysqliInfiniteLoopDetector.php
Last active April 22, 2024 17:25
Detects infinite loops containing Mysqli prepared statements by comparing the number of prepared statements run by the current process to those still active count on the DB across all processes.
<?php
/**
* Detects infinite loops containing Mysqli prepared statements
* by comparing the number of prepared statements run by the current process
* to those still active count on the DB across all processes.
*
* This class can easily be unit tested by something like this:
public function testYourQueryFunctionForInfinitLoops()
{