connect_errno) { throw new DatabaseConnectionFailedException( 'Could not connect to the database' ); } $db->set_charset('utf8mb4'); */ /* * Using the container results in the function get_prospects() returning NULL instead of an array */ /** @var Container $container */ $container = require '../src/DownlineAutomator/Bootstrap.php'; $db = $container->get(mysqli::class); xdebug_start_trace(); function get_prospects(mysqli $db) { $queryStr = <<prepare($queryStr); if ($stmt === false) { return null; } $data = [ 'accountId' => 123456789, 'sponsorLeft' => 1, 'sponsorRight' => 7262, 'reportingPeriodStart' => 454, 'reportingPeriodEnd' => 460, ]; $stmt->bind_param( 'iiiii', $data['accountId'], $data['sponsorLeft'], $data['sponsorRight'], $data['reportingPeriodStart'], $data['reportingPeriodEnd'] ); if (!$stmt->execute()) { $stmt->close(); return null; } $stmt->bind_result( $memberId, $autoship, $reportingPeriod, $pv ); $data = []; while ($stmt->fetch()) { $data[] = [ 'memberId' => $memberId, 'autoship' => $autoship, 'reportingPeriod' => $reportingPeriod, 'pv' => $pv, ]; } $stmt->close(); $out = array_filter( $data, static function ($v) { return $v[ 'pv' ] >= 0; } ); return $out; //BREAKPOINT HERE CAUSES NULL RETURN } $prospects = get_prospects($db); var_dump($prospects); xdebug_stop_trace();