Bug #76850 [Opn->Ver]: Exit code mangled by set locale/preg_match
| From: | cmb@php.net | Date: | Sat, 08 Sep 2018 11:29:36 +0000 |
| Subject: | Bug #76850 [Opn->Ver]: Exit code mangled by set locale/preg_match | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-216930@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76850&edit=1
ID: 76850
Updated by: cmb@php.net
Reported by: cschneid at cschneid dot com
Summary: Exit code mangled by set locale/preg_match
-Status: Open
+Status: Verified
Type: Bug
Package: PCRE related
Operating System: Linux
PHP Version: 7.3Git-2018-09-07 (Git)
-Assigned To:
+Assigned To: ab
Block user comment: N
Private report: N
New Comment:
Thanks for reporting! I can confirm the issue, and also that the
regression has been introduced with commit 684ce24[1]. valgrind
reports a single memory leak regarding a zend_string[2], but it
also reports this leak for earlier commits. However, running with
a debug build yields:
[Sat Sep 8 13:26:03 2018] Script: '/mnt/c/Users/cmb/php-dev/76850.php'
/mnt/c/Users/cmb/php-dev/php-src/Zend/zend_string.h(133) : Freeing 0x00007f5b50c01730 (40
bytes), script=/mnt/c/Users/cmb/php-dev/76850.php
=== Total 1 memory leaks detected ===
zend_mm_heap corrupted
Segmentation fault (core dumped)
Anantol, could you please have a look at this?
[1] <http://git.php.net/?p=php-src.git;a=commit;h=684ce24eecc5afe7ba767e721c29ef3bb191c43c>
[2] <https://github.com/php/php-src/blob/php-7.3.0beta3/ext/pcre/php_pcre.c#L840>
Previous Comments:
------------------------------------------------------------------------
[2018-09-07 15:42:58] cschneid at cschneid dot com
Description:
------------
PHP's shell return code is 1 where 0 is expected when running
php -n t.php; echo $?
I bisected the problem and it seems to work before commit 684ce24eecc5afe7ba767e721c29ef3bb191c43c
which is pcre/locale related.
The locale returned by the first setlocale is de_CH.UTF-8 and I'm using openSUSE Tumbleweed
20180829.
Test script:
---------------
<?php
function foo()
{
$oldlocale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, $oldlocale);
}
foo();
preg_match('/./', "a");
Expected result:
----------------
Return code 0
Actual result:
--------------
Return code 1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76850&edit=1