mgree / phpenkoder

Mirror of https://plugins.trac.wordpress.org/browser/php-enkoder/. Wordpress plugin for obfuscating email addresses.
http://www.weaselhat.com/phpenkoder/
BSD 3-Clause "New" or "Revised" License
4 stars 4 forks source link

fix: typos in enk_extract_linktext / LINKTEXT #5

Closed basscl closed 3 years ago

basscl commented 3 years ago

line 146 define("LINK_TEXT", "#/>(.?)</a#i"); should be define("LINK_TEXT", "#>(.?)</a#i");

Text that successfully matches MAILTO_EMAIL '#(<a[^<>]?href=[\'\"]mailto:[^<>]?>.?)#i' will not then match LINK_TEXT "#/>(.?)</a#i" because of an extraneous forward slash (maybe left over from changing the regex delimiter?)

line 149 $tmatches = preg_match(LINK_TEXT, $text, $tmatches); //array(); should be preg_match(LINK_TEXT, $text, $tmatches);

The preg_match function will fill the 3rd parameter with the results of search which is what we want, but assigning the return value of the function to $tmatches as well overwrites this with 0 or 1.

fixes #4

mgree commented 3 years ago

Good catch! I am, honestly, slightly confused that it worked at all before. But all tests pass and this makes sense to me. Thank you!