Doc #76245 [NEW]: mb_ereg_match matches at beginning of subject only
| From: | jake at qzdesign dot co dot uk | Date: | Fri, 20 Apr 2018 19:25:23 +0000 |
| Subject: | Doc #76245 [NEW]: mb_ereg_match matches at beginning of subject only | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-15617@lists.php.net to get a copy of this message | ||
From: jake at qzdesign dot co dot uk
Operating system: Windows 7 32-bit
PHP version: 7.1.16
Package: mbstring related
Bug Type: Documentation Problem
Bug description:mb_ereg_match matches at beginning of subject only
Description:
------------
The manual page for
mb_ereg_match at
https://secure.php.net/manual/en/function.mb-ereg-match.php
makes no
mention that $pattern is only matched at the beginning of $string
(i.e. it includes an implied ^ at the start).
It is mentioned in a user contributed note, but this behaviour really
should be included in the main documentation, probably in a highlighted
"Note" or "Warning" box, as it is very important for using the function,
and the behaviour would be unexpected as most other similar functions in
both PHP and other languages do not behave this way.
(It may be a bug in the function and it is not supposed to behave this
way, but for compatibility reasons it probably can't be fixed until a
major release.)
Test script:
---------------
<?php
// note space at start of $string parameter
echo mb_ereg_match('[[:alpha:]]', ' a') ? 'matched' : 'not
matched';
Expected result:
----------------
Based on the documentation as it is, I expected "matched" to be output.
I expect to be able to easily determine what this simple script would
output from the documantation.
Actual result:
--------------
"not matched" is output, but the documentation makes no indication that
this would be the case.
--
Edit bug report at https://bugs.php.net/bug.php?id=76245&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76245&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76245&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76245&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76245&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76245&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76245&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76245&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76245&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76245&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76245&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76245&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76245&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76245&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76245&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76245&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76245&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76245&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76245&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76245&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76245&r=mysqlcfg