3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function sanitizeUri($uri) { $keysToSanitize = array( 'password', 'provider_refresh_token', 'provider_consumer_secret' ); foreach ($keysToSanitize as $key) { $pattern = "/(?:\?|&)$key=(\S*?)(?:\s|&)?"; while (preg_match($pattern, $uri, $matches) && $matches[1] != "**hidden**") { $uri = str_replace($matches[1], "**hidden**", $uri); } } return $uri; } $uri1 = "POST /2.0/accounts/5520ccca39a0328d4d8b456a/sources?label=0&type=IMAP&use_ssl=1&passwOrd=pizza&email=kaisi789%40aol.com&server=imap.yahoo.com&port=993&username=kaisi789%40aol.com&passWord=nachos HTTP/1.0"; $uri2 = "POST /2.0/accounts/5520ccca39a0328d4d8b456a/sources?label=0&type=IMAP&use_ssl=1&provider_refresh_token=sidfosdifo2 HTTP/1.0"; $uri3 = "POST /2.0/accounts/5520ccca39a0328d4d8b456a/sources?provider_refresh_token=sidfosdifo2"; print_r(sanitizeUri($uri1) . "\n"); print_r(sanitizeUri($uri2) . "\n"); print_r(sanitizeUri($uri3) . "\n");
Output for 4.3.11 - 7.3.0beta1
Warning: preg_match(): No ending delimiter '/' found in /in/cEnYo on line 12 Warning: preg_match(): No ending delimiter '/' found in /in/cEnYo on line 12 Warning: preg_match(): No ending delimiter '/' found in /in/cEnYo on line 12 POST /2.0/accounts/5520ccca39a0328d4d8b456a/sources?label=0&type=IMAP&use_ssl=1&passwOrd=pizza&email=kaisi789%40aol.com&server=imap.yahoo.com&port=993&username=kaisi789%40aol.com&passWord=nachos HTTP/1.0 Warning: preg_match(): No ending delimiter '/' found in /in/cEnYo on line 12 Warning: preg_match(): No ending delimiter '/' found in /in/cEnYo on line 12 Warning: preg_match(): No ending delimiter '/' found in /in/cEnYo on line 12 POST /2.0/accounts/5520ccca39a0328d4d8b456a/sources?label=0&type=IMAP&use_ssl=1&provider_refresh_token=sidfosdifo2 HTTP/1.0 Warning: preg_match(): No ending delimiter '/' found in /in/cEnYo on line 12 Warning: preg_match(): No ending delimiter '/' found in /in/cEnYo on line 12 Warning: preg_match(): No ending delimiter '/' found in /in/cEnYo on line 12 POST /2.0/accounts/5520ccca39a0328d4d8b456a/sources?provider_refresh_token=sidfosdifo2
Output for 4.3.0 - 4.3.10
Warning: No ending delimiter '/' found in /in/cEnYo on line 12 Warning: No ending delimiter '/' found in /in/cEnYo on line 12 Warning: No ending delimiter '/' found in /in/cEnYo on line 12 POST /2.0/accounts/5520ccca39a0328d4d8b456a/sources?label=0&type=IMAP&use_ssl=1&passwOrd=pizza&email=kaisi789%40aol.com&server=imap.yahoo.com&port=993&username=kaisi789%40aol.com&passWord=nachos HTTP/1.0 Warning: No ending delimiter '/' found in /in/cEnYo on line 12 Warning: No ending delimiter '/' found in /in/cEnYo on line 12 Warning: No ending delimiter '/' found in /in/cEnYo on line 12 POST /2.0/accounts/5520ccca39a0328d4d8b456a/sources?label=0&type=IMAP&use_ssl=1&provider_refresh_token=sidfosdifo2 HTTP/1.0 Warning: No ending delimiter '/' found in /in/cEnYo on line 12 Warning: No ending delimiter '/' found in /in/cEnYo on line 12 Warning: No ending delimiter '/' found in /in/cEnYo on line 12 POST /2.0/accounts/5520ccca39a0328d4d8b456a/sources?provider_refresh_token=sidfosdifo2