Bug #75832 [Fbk->NoF]: Segmentation fault after preg_match w/ utf8 (or extended ascii?)

From: Date: Sat, 05 May 2018 21:53:42 +0000
Subject: Bug #75832 [Fbk->NoF]: Segmentation fault after preg_match w/ utf8 (or extended ascii?)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215112@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75832&edit=1 ID: 75832 Updated by: requinix@php.net Reported by: stenschke at gyselroth dot com Summary: Segmentation fault after preg_match w/ utf8 (or extended ascii?) -Status: Feedback +Status: No Feedback Type: Bug Package: PCRE related Operating System: Linux PHP Version: 7.1Git-2018-01-17 (Git) Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2018-01-17 12:57:25] requinix@php.net Still want that backtrace. But don't mix an ISO 8859-1 input string with a UTF-8 pattern and the /u flag. It won't work. (Shouldn't crash, though.) ------------------------------------------------------------------------ [2018-01-17 12:51:30] stenschke at gyselroth dot com I made a copy/paste error, correct code is: $xml = utf8_decode('<w:fldSimple w:instr=" MERGEFIELD Üüü \* MERGEFORMAT "><w:r><w:t xml:space="preserve">«Üüü»</w:t></w:r></w:fldSimple>'); preg_match('/<w:fldSimple w:instr="\s*MERGEFIELD\s*([a-zäöü|\d|_|\.]*)\s*\\\*\s*/u', $xml, $matches); ------------------------------------------------------------------------ [2018-01-17 12:36:18] requinix@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. ------------------------------------------------------------------------ [2018-01-17 12:16:11] stenschke at gyselroth dot com Description: ------------ Following code causes PHP error: "Segmentation fault (core dumped)" utf8_decode('<w:fldSimple w:instr=" MERGEFIELD Üüü \* MERGEFORMAT "><w:r><w:t xml:space="preserve">«Üüü»</w:t></w:r></w:fldSimple>'); preg_match('/<w:fldSimple w:instr="\s*MERGEFIELD\s*([a-zäöü|\d|_|\.]*)\s*\\\*\s*/u', $xml, $matches); P.s. Exact used PHP version (not in bugtracker's options) is: PHP 7.1.11-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Oct 27 2017 13:49:56) Actual result: -------------- Array() ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75832&edit=1

« previous php.bugs (#215112) next »