utopia-php-std 0.1.0

PHP engine semantics (the value model, juggling and comparison, string, number, JSON, serialize, igbinary, sorting, filter and URL functions) for crates that must behave exactly like PHP.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* php-std's one addition to the PCRE2 sources: whether a code point is in
\pL or \pN by PCRE2's own Unicode tables (Unicode 15.0.0), so that
FILTER_VALIDATE_EMAIL's hand-written check classifies characters exactly
like the regular expression PHP runs. */

#include "config.h"
#include "pcre2_internal.h"

int php_std_pcre2_is_letter_or_number(uint32_t c)
{
  unsigned int type;
  if (c > MAX_UTF_CODE_POINT) return 0;
  type = PRIV(ucp_gentype)[UCD_CHARTYPE(c)];
  return type == ucp_L || type == ucp_N;
}