-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Modernised phpinfo HTML somewhat #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4db70fd
128a4bb
c98a51a
054e41f
ac076f9
25859b9
7eb0da8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,7 +144,7 @@ PHPAPI void php_info_print_module(zend_module_entry *zend_module TSRMLS_DC) /* { | |
{ | ||
if (zend_module->info_func || zend_module->version) { | ||
if (!sapi_module.phpinfo_as_text) { | ||
php_info_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", zend_module->name, zend_module->name); | ||
php_info_printf("<h2><a id=\"module_%s\">%s</a></h2>\n", zend_module->name, zend_module->name); | ||
} else { | ||
php_info_print_table_start(); | ||
php_info_print_table_header(1, zend_module->name); | ||
|
@@ -624,14 +624,11 @@ PHPAPI char *php_get_uname(char mode) | |
*/ | ||
PHPAPI void php_print_info_htmlhead(TSRMLS_D) | ||
{ | ||
php_info_print("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"); | ||
php_info_print("<html xmlns=\"http://www.w3.org/1999/xhtml\">"); | ||
php_info_print("<head>\n"); | ||
php_info_print("<!doctype html>\n<meta charset=utf-8>"); | ||
php_info_print_style(TSRMLS_C); | ||
php_info_print("<title>phpinfo()</title>"); | ||
php_info_print("<meta name=\"ROBOTS\" content=\"NOINDEX,NOFOLLOW,NOARCHIVE\" />"); | ||
php_info_print("</head>\n"); | ||
php_info_print("<body><div class=\"center\">\n"); | ||
php_info_print("<div class=\"center\">\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why body tag is dropped? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For file size optimization and scannability purposes, consider omitting optional tags. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. I do this with all my HTML, it's much simpler, and doesn't really do that much. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bojieli Neither reason is applicable here. What is applicable is writing tools that can easily read this information. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't really supposed to be machine-readable, that's the text format's job. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TazeTSchnitzel Maybe I'm the only one who thinks dropping the body tag is a terrible idea. I've voiced my opinion and that's all I can do. I do agree that the text-format is designed to be human readable, but that doesn't mean we should rape our HTML. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @morrisonlevi rape? It's perfectly valid in HTML5. We aren't dealing with XHTML, here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be clear: I am all for updating the output, but I see absolutely no reason to approve this pull request. HTML5 give absolutely no benefit over what we already have. HTML5 is not even finalized. My previous comment was a little harsh. I meant it that way because I feel strongly about this, but I would like to say I do not intend for it to be argumentative. I merely want to express my opinion without it being misunderstood. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This pull request does more than use HTML5. It uses tables less, removes some inline styling, etc, But you're right in that it adds almost nothing, so I'll close it. |
||
} | ||
/* }}} */ | ||
|
||
|
@@ -676,7 +673,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) | |
the_time = time(NULL); | ||
ta = php_localtime_r(&the_time, &tmbuf); | ||
|
||
php_info_print("<a href=\"http://www.php.net/\"><img border=\"0\" src=\""); | ||
php_info_print("<a href=\"http://www.php.net/\"><img src=\""); | ||
if (ta && (ta->tm_mon==3) && (ta->tm_mday==1)) { | ||
php_info_print(PHP_EGG_LOGO_DATA_URI "\" alt=\"PHP logo\" /></a>"); | ||
} else { | ||
|
@@ -783,7 +780,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) | |
/* Zend Engine */ | ||
php_info_print_box_start(0); | ||
if (!sapi_module.phpinfo_as_text) { | ||
php_info_print("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\""); | ||
php_info_print("<a href=\"http://www.zend.com/\"><img src=\""); | ||
php_info_print(ZEND_LOGO_DATA_URI "\" alt=\"Zend logo\" /></a>\n"); | ||
} | ||
php_info_print("This program makes use of the Zend Scripting Language Engine:"); | ||
|
@@ -919,15 +916,15 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) | |
} | ||
|
||
if (!sapi_module.phpinfo_as_text) { | ||
php_info_print("</div></body></html>"); | ||
php_info_print("</div>"); | ||
} | ||
} | ||
/* }}} */ | ||
|
||
PHPAPI void php_info_print_table_start(void) /* {{{ */ | ||
{ | ||
if (!sapi_module.phpinfo_as_text) { | ||
php_info_print("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n"); | ||
php_info_print("<table>\n"); | ||
} else { | ||
php_info_print("\n"); | ||
} | ||
|
@@ -945,14 +942,13 @@ PHPAPI void php_info_print_table_end(void) /* {{{ */ | |
|
||
PHPAPI void php_info_print_box_start(int flag) /* {{{ */ | ||
{ | ||
php_info_print_table_start(); | ||
if (flag) { | ||
if (!sapi_module.phpinfo_as_text) { | ||
php_info_print("<tr class=\"h\"><td>\n"); | ||
php_info_print("<div class=\"h box\">\n"); | ||
} | ||
} else { | ||
if (!sapi_module.phpinfo_as_text) { | ||
php_info_print("<tr class=\"v\"><td>\n"); | ||
php_info_print("<div class=\"v box\">\n"); | ||
} else { | ||
php_info_print("\n"); | ||
} | ||
|
@@ -963,7 +959,7 @@ PHPAPI void php_info_print_box_start(int flag) /* {{{ */ | |
PHPAPI void php_info_print_box_end(void) /* {{{ */ | ||
{ | ||
if (!sapi_module.phpinfo_as_text) { | ||
php_info_print("</td></tr>\n"); | ||
php_info_print("</div>\n"); | ||
} | ||
php_info_print_table_end(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--TEST-- | ||
bug 40459 - Test whether the constructor of the user-space stream wrapper is called when stream functions are called | ||
--FILE-- | ||
<?php | ||
// Test whether the constructor of the user-space stream wrapper is called when stream functions are called | ||
class testwrapper { | ||
private $constructorCalled = false; | ||
function __construct() { | ||
$this->constructorCalled = true; | ||
} | ||
|
||
function stream_open($path, $mode, $options, &$opened_path) | ||
{ | ||
echo $this->constructorCalled ? 'yes' : 'no'; | ||
return true; | ||
} | ||
|
||
function url_stat($url, $flags) | ||
{ | ||
echo $this->constructorCalled ? 'yes' : 'no'; | ||
return array(); | ||
} | ||
|
||
function unlink($url) | ||
{ | ||
echo $this->constructorCalled ? 'yes' : 'no'; | ||
} | ||
|
||
function rename($from, $to) | ||
{ | ||
echo $this->constructorCalled ? 'yes' : 'no'; | ||
} | ||
|
||
function mkdir($dir, $mode, $options) | ||
{ | ||
echo $this->constructorCalled ? 'yes' : 'no'; | ||
} | ||
|
||
function rmdir($dir, $options) | ||
{ | ||
echo $this->constructorCalled ? 'yes' : 'no'; | ||
} | ||
|
||
function dir_opendir($url, $options) | ||
{ | ||
echo $this->constructorCalled ? 'yes' : 'no'; | ||
return TRUE; | ||
} | ||
function stream_metadata() | ||
{ | ||
echo $this->constructorCalled ? 'yes' : 'no'; | ||
return TRUE; | ||
} | ||
} | ||
|
||
stream_wrapper_register('test', 'testwrapper', STREAM_IS_URL); | ||
|
||
echo 'stream_open: '; | ||
fopen('test://test', 'r'); | ||
echo "\n"; | ||
|
||
echo 'url_stat: '; | ||
stat('test://test'); | ||
echo "\n"; | ||
|
||
echo 'dir_opendir: '; | ||
opendir('test://test'); | ||
echo "\n"; | ||
|
||
echo 'rmdir: '; | ||
rmdir('test://test'); | ||
echo "\n"; | ||
|
||
echo 'mkdir: '; | ||
mkdir('test://test'); | ||
echo "\n"; | ||
|
||
echo 'rename: '; | ||
rename('test://test', 'test://test2'); | ||
echo "\n"; | ||
|
||
echo 'unlink: '; | ||
unlink('test://test'); | ||
echo "\n"; | ||
|
||
echo 'touch: '; | ||
touch('test://test', time()); | ||
echo "\n"; | ||
|
||
|
||
|
||
?> | ||
==DONE== | ||
--EXPECT-- | ||
stream_open: yes | ||
url_stat: yes | ||
dir_opendir: yes | ||
rmdir: yes | ||
mkdir: yes | ||
rename: yes | ||
unlink: yes | ||
touch: yes | ||
==DONE== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I just use <!doctype> because it looks nicer imo. I don't think it matters.
Also I don't think lang=en matters. If you mean the html tag, that can be omitted and is perfectly valid html (and for simple header pages like this, cleaner imo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should drop html tag. Maybe it's allowed by the standard, but many tools would assume it's there, why make their lives harder?