php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68746 preg_split doesn't always split when it should
Submitted: 2015-01-05 07:04 UTC Modified: 2015-01-05 07:12 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: mr_platelet+jin6vr at fastmail dot fm Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.4.36 OS: FreeBSD
Private report: No CVE-ID: None
 [2015-01-05 07:04 UTC] mr_platelet+jin6vr at fastmail dot fm
Description:
------------
I doubt it's relevant, but the following
is my `configure' command, as output by "php -i":

'./configure'  '--prefix=/usr/local/php/5.4.36-nfsn1' '--includedir=/usr/local/php/5.4.36-nfsn1/include/' '--libdir=/usr/local/php/5.4.36-nfsn1' '--mandir=/usr/local/php/5.4.36-nfsn1/man/' '--with-config-file-path=/usr/local/php/5.4.36-nfsn1/etc/' '--disable-all' '--with-openssl' '--disable-cgi' '--enable-cli' '--enable-libxml' '--enable-xml' '--enable-simplexml' '--enable-pdo' '--with-mysql=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pcre-regex=/usr/local' '--with-pear=/usr/local/php/5.4.36-nfsn1/lib/'

Test script:
---------------
echo
  count(
    preg_split(
      '@\s*\n\s*\n\s*@',
      "aa bb\n\ncc dd\n \nee ff\n\n",
      PREG_SPLIT_NO_EMPTY
    )
  ),
  "\n";


Expected result:
----------------
I expect the following to
be printed:

3

Actual result:
--------------
The following is printed:

1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-05 07:12 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2015-01-05 07:12 UTC] requinix@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Check the documentation for what the third argument is supposed to be.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 19:01:29 2024 UTC