|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-05-31 16:43 UTC] 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', ]; " PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 23:00:01 2025 UTC |
> Because `$a = [ 'a', 'b', ];` is a parse error says who? this is not and was not a parse-error over decades and it#s even what proper codebases for long-arrays always do when each item is in a seperate line - please verify before you pretend such false statements php > $a = [ 'a', 'b', ]; php > print_r($a); Array ( [0] => a [1] => b ) php >