Bug #76398 [Opn]: Function `php_strip_whitespace` with multiline array.

From: Date: Thu, 31 May 2018 16:50:03 +0000
Subject: Bug #76398 [Opn]: Function `php_strip_whitespace` with multiline array.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215459@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76398&edit=1 ID: 76398 Updated by: peehaa@php.net Reported by: kmvan dot com at gmail dot com Summary: Function php_strip_whitespace with multiline array. Status: Open Type: Bug Package: Arrays related Operating System: Windows/Linux PHP Version: 7.1.18 Block user comment: N Private report: N New Comment: Why would it strip commas? And why would it result in a parse error? Feels like there is something else wrong. Previous Comments: ------------------------------------------------------------------------ [2018-05-31 16:43:54] kmvan dot com at gmail dot com Description: ------------ If a two-dimensional multiline array ends with a comma. The function php_strip_whitespace can not trim the last comma in single line, so cause parse error. File a.php: <?php $a = [ 'a', 'b', ]; Test script: --------------- <?php \var_dump(\php_strip_whitespace(__DIR__ . '/a.php')); // output: string(26) "<?php $a = [ 'a', 'b', ]; " Expected result: ---------------- // output: string(25) "<?php $a = [ 'a', 'b' ]; " Actual result: -------------- // output: string(26) "<?php $a = [ 'a', 'b', ]; " ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76398&edit=1

« previous php.bugs (#215459) next »