|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73870 php.exe crash in service context
Submitted: 2017-01-05 10:49 UTC Modified: 2017-01-08 20:22 UTC
From: jean-baptiste at nahan dot fr Assigned: ab (profile)
Status: Closed Package: Reproducible crash
PHP Version: 7.1.0 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jean-baptiste at nahan dot fr
New email:
PHP Version: OS:


 [2017-01-05 10:49 UTC] jean-baptiste at nahan dot fr
Requirements : win32service extension. Available here

This script work fine with php-7.0.x but not with PHP-7.1.

On windows system the context of service execution is not a console. php.exe crash in the service context when he get the Codepage.
With the patch, the service can started with use php.exe or php-win.exe.

An issue is open on the win32service extension. The link is:
This issue contains build information and other results tests.

Test script:
 * File : sample.php
 * This file is part of win32service extension package.
 * This file install or uninstall the "dummyphp" service.
 * Requirements : PHP 7+
 * Usage :
 * php sample.php install
 * net start dummyphp
 * net stop dummyphp
 * php sample.php uninstall

 if (!extension_loaded('win32service')) {
	throw new \Exception('The php_win32service.dll extension is not loaded ! Please configure it into your php configuration file.');
if ($argv[1] == 'install') {
	$x = win32_create_service(array(
		'service' => 'dummyphp',
		'display' => 'sample dummy PHP service',
		'params' => __FILE__ . ' run',
} else if ($argv[1] == 'uninstall') {
	$x = win32_delete_service('dummyphp');
} else if ($argv[1] != 'run') {
	die("bogus args");

$x = win32_start_service_ctrl_dispatcher('dummyphp');


while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {

Expected result:
Service do start.

Actual result:
php.exe crash:

Une exception non gérée a été levée : violation d'accès en lecture.
__imp__php_win32_cp_get_orig(...) retournée nullptr.

>	php.exe!main(int argc, char * * argv) Ligne 1358	C
 	[Code externe]


fix_get_codepage (last revision 2017-01-05 10:49 UTC by jean-baptiste at nahan dot fr)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-05 14:41 UTC]
-Status: Open +Status: Feedback
 [2017-01-05 14:41 UTC]
Thanks for the patch. Could you please check the current 7.1 dev tree? Several improvements went in since 7.1.0, so i guess the patch won't apply in the form there and this issue might be even fixed already. You can just fetch the latest snapshot from, no need to compile yourself. Or use 7.1.1RC1 which is coming out soon.

 [2017-01-05 15:17 UTC] jean-baptiste at nahan dot fr
The test from PHP 7.1.1-dev on branch PHP-7.1 work fine.

How to add error alert if the extension is loaded on PHP 7.1.0 ?

 [2017-01-06 16:07 UTC]
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: ab
 [2017-01-06 16:07 UTC]
I don't think it'll be possible to catch this in the extension. I'd also wonder a bit, as it should have been explicitly excluded from php-win.exe. Maybe it was done not a correct way, as i actually had not much to test it. 

Closing this one now, as the issue looks resolved.

 [2017-01-08 20:22 UTC]
@jean-baptiste by the way - would it be something meaningful for you to propose a patch for the PECL package, or join it even? As issues like bug #73733 will for sure hit back. If so, please write to Richard and CC the PECL dev lists.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Mar 04 22:01:30 2024 UTC