Save command history when exiting interactive shell with control-c

 [2014-06-23 02:08 UTC] ryan dot brothers at gmail dot com

Description:
------------
When using the PHP interactive shell (php -a), pressing Control-C to exit the shell does not write your last commands to ~/.php_history.  Both the mysql and mongo console clients save your command history when you press Control-C to exit.  Could the PHP interactive shell be updated to save your command history when Control-C is pressed to exit the shell?  I use Control-C to exit various console clients, and often lose my last run commands in the PHP interactive shell since they are not saved when Control-C is used to exit the shell.

Test script:
---------------
1) Run: php -a
2) Type: $a = 1;
3) Press: Control-C
4) Run: php -a
5) Press up.

Expected result:
----------------
php > $a = 1;

Actual result:
--------------
php > $b = 2;


 [2017-03-31 17:41 UTC] bukka@php.net

-Assigned To: +Assigned To: bukka

 [2017-03-31 17:41 UTC] bukka@php.net

Sorry wrong number - the commit above is for something else...

 [2017-03-31 17:42 UTC] bukka@php.net

-Assigned To: bukka +Assigned To: x