1--TEST-- 2Do not inherit LC_CTYPE from environment 3--EXTENSIONS-- 4ctype 5--SKIPIF-- 6<?php 7if (setlocale(LC_ALL, 'invalid') === 'invalid') { die('skip setlocale() is broken /w musl'); } 8if (!setlocale(LC_CTYPE, "de_DE", "de-DE")) die("skip requires de_DE locale"); 9?> 10--ENV-- 11LC_CTYPE=de_DE 12--FILE-- 13<?php 14 15echo "inherited\n"; 16echo 'ctype_lower(\xe4): ' . (ctype_lower("\xe4") ? 'y' : 'n') . "\n"; 17echo 'preg_match(\w, \xe4): '; 18var_dump(preg_match('/\w/', "\xe4")); 19 20var_dump(setlocale(LC_CTYPE, "0")); 21echo 'ctype_lower(\xe4): ' . (ctype_lower("\xe4") ? 'y' : 'n') . "\n"; 22echo 'preg_match(\w, \xe4): '; 23var_dump(preg_match('/\w/', "\xe4")); 24 25echo "de_DE\n"; 26var_dump(setlocale(LC_CTYPE, "de_DE", "de-DE") !== false); 27echo 'ctype_lower(\xe4): ' . (ctype_lower("\xe4") ? 'y' : 'n') . "\n"; 28echo 'preg_match(\w, \xe4): '; 29var_dump(preg_match('/\w/', "\xe4")); 30?> 31--EXPECTF-- 32inherited 33ctype_lower(\xe4): n 34preg_match(\w, \xe4): int(0) 35string(%d) "C%r(\.UTF-8)?%r" 36ctype_lower(\xe4): n 37preg_match(\w, \xe4): int(0) 38de_DE 39bool(true) 40ctype_lower(\xe4): y 41preg_match(\w, \xe4): int(1) 42