[php-src] Issue #8950: php_cli Segmentation fault

From: Date: Fri, 08 Jul 2022 06:25:14 +0000
Subject: [php-src] Issue #8950: php_cli Segmentation fault
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241880@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8950 Author: wzgl ### Description The following code: Sometimes when I run php script using php command,I get a Segmentation fault. I don't know why.so I need some help! ```php <?php require_once "/var/www/html/function.php"; require_once "/var/www/html/send_sms.php"; global $DB; $path = '/var/www/html//times/'; $fileName = 'sendTimes.json'; $sql = "SELECT DeviceID,Tel,AdminID FROM TSMSCode GROUP BY DeviceID,Tel,AdminID"; $res = $DB->getFetchAll($sql); if (!file_exists($path . $fileName)) { cutil_php_debug("File not exist ,Quit!", 'SmsLimitReset'); exit; } $sendSMS = AjaxSend_SMS::recordSMSTimes($sendSMS, 1); if (is_array($res) && count($res) > 0) { foreach ($res as $index => $smsVal) { $id = 0; $SendType = $smsVal['AdminID'] > 0 ? 'admin' : 'user'; if ($SendType === 'admin') { $id = $smsVal['AdminID']; } else { $id = $smsVal['DeviceID']; } if (isset($sendSMS[$SendType][$id][$smsVal['Tel']]) && $sendSMS[$SendType][$id][$smsVal['Tel']]['expired'] < time() && $sendSMS[$SendType][$id][$smsVal['Tel']]['usedTimes'] >= AjaxSend_SMS::getSendTimes('times')) { $sendSMS[$SendType][$id][$smsVal['Tel']] = AjaxSend_SMS::defaultSmsLimit(); // print_r($sendSMS); AjaxSend_SMS::recordSMSTimes($sendSMS); cutil_php_debug("Reset Device :" . $smsVal['DeviceID'] . " Tel:" . $smsVal['Tel'], 'SmsLimitReset'); } } } Resulted in this output: ![image](https://user-images.githubusercontent.com/14242762/177926637-29e1c6d9-475f-4357-a6ef-dcf80d272b8a.png) But I expected this output instead: run success! there is a core dump file: [core.php.1498679.11.zip](https://github.com/php/php-src/files/9069261/core.php.1498679.11.zip) I have tried using gdb command to analyze core dump file,but I still don't know why. I hope the screenshots below are of some help to you: ![image](https://user-images.githubusercontent.com/14242762/177928126-937f3e56-d16c-4c72-b4e1-49ddb6005f7f.png) ![image](https://user-images.githubusercontent.com/14242762/177929064-917c0167-e9e5-4474-afea-fed24707b299.png) ### PHP Version PHP 7.3.24 ### Operating System Centos 6.10

« previous php.bugs (#241880) next »