php - parse_url giving host name as stars when debugged (but can still get value) -


using php 5.5.12

using cakephp 2.6.7

running

debug($url); // output = "http://google.co.uk"  debug(parse_url($url)); /* output = array(                 'host' => '*****',                 'scheme' => 'http'             ) */ 

i had been using without trouble copy/pasting section of code have method (to save repeating myself) has started giving me output. testing in same place had gives me output too.

can explain why hostname stars , why rest of array doesn't appear (i realise other elements should expected null)?

edit

just tried again url had path page after host. path shows fine host still starred out.

partial answer

just thought try debug(parse_url($url)['host']) , prints host correctly. realised other elements set if exist in url.

however, can explain why printing out array prints several stars instead of hostname though stored there?

the reason happens because of how debug() works. many moons ago people not pleased accidentally have database credentials dumped out in error pages (which use same underlying code debug()). because of this, debug() , debugger::export() blacklist set of array keys could have database credentials. following keys replaced ***'s:

  • password
  • login
  • host
  • database
  • port
  • prefix
  • schema

Comments