Skip to content

Commit

Permalink
Merge pull request #23 from jrfnl/feature/update-static-sheets
Browse files Browse the repository at this point in the history
Feature/update static sheets
  • Loading branch information
jrfnl committed Nov 8, 2015
2 parents d992e06 + 0dd898d commit fd560ab
Show file tree
Hide file tree
Showing 128 changed files with 1,001,723 additions and 618,939 deletions.
38 changes: 29 additions & 9 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,38 @@ RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.3\.02\.html$ h
# 5.4.(0)6 => 5.4.4
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.(0)?6\.html$ http://phpcheatsheets.com/static_results/$1/php5.4.4.html

# 5.4.35/37 => 5.4.36
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.3[57]\.html$ http://phpcheatsheets.com/static_results/$1/php5.4.36.html
# 5.4.11/20 => 5.4.16
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.(11|20)\.html$ http://phpcheatsheets.com/static_results/$1/php5.4.16.html

# 5.4.33/35/37 => 5.4.36
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.3[357]\.html$ http://phpcheatsheets.com/static_results/$1/php5.4.36.html

# 5.4.42 => 5.4.43
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.42\.html$ http://phpcheatsheets.com/static_results/$1/php5.4.43.html

# 5.5.18 => 5.5.16
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.18\.html$ http://phpcheatsheets.com/static_results/$1/php5.5.16.html

# 5.5.20/21 => 5.5.22
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.2[01]\.html$ http://phpcheatsheets.com/static_results/$1/php5.5.22.html
# 5.5.20/22 => 5.5.21
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.2[02]\.html$ http://phpcheatsheets.com/static_results/$1/php5.5.21.html

# 5.5.24 => 5.5.26
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.24\.html$ http://phpcheatsheets.com/static_results/$1/php5.5.26.html

# 5.6.2 => 5.6.0
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.2\.html$ http://phpcheatsheets.com/static_results/$1/php5.6.0.html

# 5.6.4/5 => 5.6.7
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.[45]\.html$ http://phpcheatsheets.com/static_results/$1/php5.6.7.html

# 5.6.8 => 5.6.9
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.8\.html$ http://phpcheatsheets.com/static_results/$1/php5.6.9.html

# 5.6.4 => 5.6.5
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.4\.html$ http://phpcheatsheets.com/static_results/$1/php5.6.5.html
# 5.6.10 => 5.6.11
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.10\.html$ http://phpcheatsheets.com/static_results/$1/php5.6.11.html

# 7.0.0alpha1 => 7.0.0RC6
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.0\.0alpha1\.html$ http://phpcheatsheets.com/static_results/$1/php7.0.0RC6.html


# Add 404 directives
Expand All @@ -60,13 +80,13 @@ RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK|DEBUG) [NC]
RewriteRule ^(.*)$ - [F,L]

# Redirect GET requests from the dropdown to html files
RewriteCond %{QUERY_STRING} page=(arithmetic|compare|test)&tab=([a-z0-9_-]+)&phpversion=(php[0-9\.-]+((alpha|beta|rc)([0-9])?)?) [NC]
RewriteCond %{QUERY_STRING} page=(arithmetic|compare|test)&tab=([a-z0-9_-]+)&phpversion=(php[0-9\.-]+((alpha|beta|RC)([0-9])?)?) [NC]
RewriteRule index.php /static_results/%1/%3.html#%2? [NE,R=301,L]

RewriteCond %{QUERY_STRING} page=(arithmetic|compare|test)&tab=&phpversion=(php[0-9\.-]+((alpha|beta|rc)([0-9])?)?) [NC]
RewriteCond %{QUERY_STRING} page=(arithmetic|compare|test)&tab=&phpversion=(php[0-9\.-]+((alpha|beta|RC)([0-9])?)?) [NC]
RewriteRule index.php /static_results/%1/%2.html? [R=301,L]

RewriteCond %{QUERY_STRING} page=(arithmetic|compare|test)&phpversion=(php[0-9\.-]+((alpha|beta|rc)([0-9])?)?) [NC]
RewriteCond %{QUERY_STRING} page=(arithmetic|compare|test)&phpversion=(php[0-9\.-]+((alpha|beta|RC)([0-9])?)?) [NC]
RewriteRule index.php /static_results/%1/%2.html? [R=301,L]


Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,20 @@ In general, a balance is sought between significance and variety.


#### Credits:
[Elephpant photo](http://www.flickr.com/photos/jakobwesthoff/3231273333/) by Jacob Westhoff.
[Sad Elephpant photo](http://www.flickr.com/photos/gluek/100179589/) by Gluek.
* [Elephpant photo](http://www.flickr.com/photos/jakobwesthoff/3231273333/) by Jacob Westhoff.
* [Sad Elephpant photo](http://www.flickr.com/photos/gluek/100179589/) by Gluek.


#### Changelog:

##### 1.3.1 (Nov 2015): PHP 7 is nearly upon us!
* Renewed static sheets based on currently available and most used versions:
- Added static sheets for **PHP 7.0.0-RC6**, 5.6.15, 5.6.13, 5.6.11, 5.6.9, 5.6.7, 5.5.30, 5.5.28, 5.5.21, 5.4.45, 5.4.27, 5.4.41, 5.4.43.
- Removed static sheet generation for PHP 7.0.0-alpha1, 5.6.10, 5.6.8, 5.6.5, 5.6.2, 5.5.24, 5.5.22, 5.4.42, 5.4.33, 5.4.20, 5.4.11.
* Fixed "division by zero" error catching for PHP7 as the Exception hierarchy changed in PHP7-alpha2.
* Some other minor improvements.


##### 1.3 (Jun 2015): Get ready for PHP 7!
* New tests:
- `<=>` in variable comparisons (PHP7+ only).
Expand Down
39 changes: 23 additions & 16 deletions bin/autogen-static-sheets.bat
Original file line number Diff line number Diff line change
Expand Up @@ -91,38 +91,45 @@ IF NOT EXIST "%_AUTOGEN_SCRIPT_LOCATION%" GOTO :AUTOGEN_SCRIPT_LOCATION_ERROR EL
::---------------------------------------------------------------------------------
:: Basis for PHP versions used:
::
:: Current latest version and popular versions per minor as of Jun 12th, 2015:
:: Current latest version and popular versions per minor as of Nov 5th, 2015:
:: PHP minor Latest Popular ( ~> 5% )
:: 4.3 4.3.11 4.3.9 (seeing as how low the PHP4 usage has (finally) become, now just including the last version)
:: 4.4 4.4.9 4.4.9
:: 5.0 5.0.5 5.0.4
:: 5.1 5.1.6 5.1.6
:: 5.2 5.2.17 5.2.17, 5.2.6, 5.2.9
:: 5.3 5.3.29 5.3.29, 5.3.3, 5.3.28, 5.3.10, 5.3.27 (v28 not included in run as 27 + 29 are)
:: 5.4 5.4.42 5.4.39, 5.4.40, 5.4.37, 5.4.38, 5.4.36, 5.4.35, 5.4.41, 5.4.4 (v40, v37, v38, v35 and v41 not included in run as 36, 39 and 42 are)
:: 5.5 5.5.26 5.5.9, 5.5.24, 5.5.22, 5.5.23 5.5.25, 5.5.21, 5.5.20 (v23, v25, v21 and 20 not included in run as 22, 24 and 26 are)
:: 5.6 5.6.10 5.6.8, 5.6.7, 5.6.9, 5.6.6, 5.6.0, 5.6.5, 5.6.3, 5.6.2, 5.6.4 (7, 9, 6 and 3 not included as 10, 8, 5 and 2 are and adoption so far is low)
:: 7.0 7.0.0-alpha1
:: 5.4 5.4.45 5.4.45, 5.4.43, 5.4.44, 5.4.41, 5.4.42, 5.4.39, 5.4.36, / 5.4.40, 5.4.16, 5.4.38, 5.4.37, 5.4.35, 5.4.4 (v44, v42, v40, v38, v37, v35 not included in run as 36, 39, 41 and 43 are)
:: 5.5 5.5.30 5.5.9, 5.5.30, 5.5.29, 5.5.28, 5.5.26, 5.5.27, 5.5.25, 5.5.22, 5.5.21 (v29, v27, v25, and v22 not included in run as 21, 26, 28 and 30 are)
:: 5.6 5.6.15 5.6.13, 5.6.14, 5.6.12, 5.6.9, 5.6.11, 5.6.10, 5.6.7, 5.6.0, 5.6.8, 5.6.2 (v14, v12, v10 not included as 15, 13 and 11 are)
:: 7.0 7.0.0RC6
::
:: Ubuntu LTS versions: 5.3.2 (U 10.04), 5.3.10 (U 12.04), 5.5.9 (U 14.04)
:: Debian main releases: 5.3.3 (D 6), 5.4.4 (D 7)
:: Debian main releases: 5.3.3 (D 6), 5.4.4 (D 7), 5.6.7 (D 8)
:: CentOS main releases: 5.1.6 (COS 5.11), 5.3.3 (COS 6.6), 5.4.16 (COS 7.0)
::
:: Included for historical reasons (previously generated) as no close release is still popular:
:: 5.4.11, 5.4.20
::
:: No longer included:
:: Old versions where a release close to it is now more relevant. Redirecting old links to new via .htaccess.
:: 4.3.9 => 4.3.11
:: 5.2.4 => 5.2.6
:: 5.2.8 => 5.2.9
:: 5.4.6 => 5.4.4
:: 5.4.11 => 5.4.16
:: 5.4.20 => 5.4.16
:: 5.4.33 => 5.4.36
:: 5.4.35 => 5.4.36
:: 5.4.37 => 5.4.36
:: 5.4.42 => 5.4.43
:: 5.5.18 => 5.5.16
:: 5.5.20 => 5.5.22
:: 5.5.21 => 5.5.22
:: 5.6.4 => 5.6.5
:: 5.5.20 => 5.5.21
:: 5.5.22 => 5.5.21
:: 5.5.24 => 5.5.26
:: 5.6.2 => 5.6.0
:: 5.6.4 => 5.6.7
:: 5.6.5 => 5.6.7
:: 5.6.8 => 5.6.9
:: 5.6.10 => 5.6.11
:: 7.0.0alpha1 => 7.0.0RC6
::
:: To be added when I can (finally) up the PHP version for the live version:
:: 5.4.13 (currently live)
Expand All @@ -131,10 +138,10 @@ IF NOT EXIST "%_AUTOGEN_SCRIPT_LOCATION%" GOTO :AUTOGEN_SCRIPT_LOCATION_ERROR EL

:: Run autogen for various PHP versions
:RUN_AUTOGEN
FOR %%G IN (7.0.0alpha1) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (5.6.10 5.6.8 5.6.5 5.6.2 5.6.0) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (5.5.26 5.5.24 5.5.22 5.5.16 5.5.9 5.5.3) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (5.4.42 5.4.39 5.4.36 5.4.33 5.4.20 5.4.16 5.4.11 5.4.4) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (7.0.0RC6) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (5.6.15 5.6.13 5.6.11 5.6.9 5.6.7 5.6.0) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (5.5.30 5.5.28 5.5.26 5.5.21 5.5.16 5.5.9 5.5.3) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (5.4.45 5.4.43 5.4.41 5.4.39 5.4.36 5.4.27 5.4.16 5.4.4) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (5.3.29 5.3.27 5.3.10 5.3.3 5.3.2) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (5.2.17 5.2.9-2 5.2.6) DO CALL :RUN_AUTOGEN_PHP5 %%G
FOR %%G IN (5.1.6 5.0.5 5.0.4) DO CALL :RUN_AUTOGEN_PHP5 %%G
Expand Down
2 changes: 1 addition & 1 deletion bin/autogen-static-sheets.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function fix_content( $content ) {
8 => '`Array: \(<br />\s+\)<br />\s+`',
9 => '`<t([dh])([^>]*)?>array\(\)<br />\s+</t\1>`',
// Make sure the correct PHP version nr for the live sheets is shown in the version dropdown.
10 => '`<option value="live"(?: selected="selected")?\s*>PHP [0-9\.-]+(?:(?:alpha|beta|rc)(?:[0-9])?)?</option>`',
10 => '`<option value="live"(?: selected="selected")?\s*>PHP [0-9\.-]+(?:(?:alpha|beta|RC)(?:[0-9])?)?</option>`',
// Make chosen PHP version persistent.
12 => '`<a href="http://([a-z\.-]+)/(arithmetic|compare|test)/" class="top-link(?: top-active)?">`',
// Make sure any potential links to php.net are properly linked.
Expand Down
2 changes: 1 addition & 1 deletion bin/generate-sitemaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function get_entries() {
$available = glob( APP_DIR . '/' . self::STATIC_DIR . '/' . $key . '/php*.html' );
usort( $available, 'version_compare' );

$regex = sprintf( '`^%1$s/(%2$s/%3$s/php([457]\.[0-9]+\.[0-9-]+(?:(?:alpha|beta|rc)(?:[0-9])?)?)\.html)$`',
$regex = sprintf( '`^%1$s/(%2$s/%3$s/php([457]\.[0-9]+\.[0-9-]+(?:(?:alpha|beta|RC)(?:[0-9])?)?)\.html)$`',
preg_quote( APP_DIR, '`' ),
preg_quote( self::STATIC_DIR, '`' ),
preg_quote( $key, '`' )
Expand Down
4 changes: 2 additions & 2 deletions class.vartype-php7.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function do_modulus( $var1, $var2 ) {
pr_var( $result, '', true, true );
}
}
catch ( Exception $e ) {
catch ( Error $e ) {
$message = '<span class="error">(Catchable) Fatal error</span>: ' . $e->getMessage();
self::handle_exception( $message );
}
Expand All @@ -83,7 +83,7 @@ public static function do_intdiv( $var1, $var2 ) {
try {
pr_var( intdiv( $var1, $var2 ), '', true, true );
}
catch ( Exception $e ) {
catch ( Error $e ) {
$message = '<span class="error">(Catchable) Fatal error</span>: ' . $e->getMessage();
self::handle_exception( $message );
}
Expand Down
2 changes: 1 addition & 1 deletion include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ function generate_version_dropdown() {
$optgroup_html_pattern = '
<optgroup label="PHP %1$s">%2$s' . "\n\t\t\t\t\t</optgroup>";

$regex = sprintf( '`^%1$s/static_results/%2$s/php(([457]\.[0-9]+)\.[0-9-]+(?:(?:alpha|beta|rc)(?:[0-9])?)?)\.html$`',
$regex = sprintf( '`^%1$s/static_results/%2$s/php(([457]\.[0-9]+)\.[0-9-]+(?:(?:alpha|beta|RC)(?:[0-9])?)?)\.html$`',
preg_quote( APP_DIR, '`' ),
preg_quote( $GLOBALS['type'], '`' )
);
Expand Down
4 changes: 2 additions & 2 deletions include/setup-env.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

// Make sure version id constant is available.
if ( ! defined( 'PHP_VERSION_ID' ) ) {
$version = PHP_VERSION;
define( 'PHP_VERSION_ID', (int) ( $version{0} * 10000 + $version{2} * 100 + $version{4} ) );
$version = explode( '.', PHP_VERSION );
define( 'PHP_VERSION_ID', (int) ( $version[0] * 10000 + $version[1] * 100 + $version[2] ) );
unset( $version );
}

Expand Down
20 changes: 10 additions & 10 deletions include/vars-to-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@
* Variable legend.
*/
$legend_array = array(
'i8' => '$x = 0xCC00F9; // hexadecimal integer',
'i9' => '$x = 052; // octal integer',
'ia' => '$x = 0b0111001; // binary integer (PHP5.4+)',
'ib' => '$x = ‏௫‏; // Tamil digit five - entered as string as PHP itself cannot deal with it as an integer',
'ic' => '$x = ⁸₈; // Unicode superscript and subscript digit 8 - entered as strings as PHP itself cannot deal with these as an integers',
'i8' => '$x = 0xCC00F9; // Hexadecimal integer.',
'i9' => '$x = 052; // Octal integer.',
'ia' => '$x = 0b0111001; // Binary integer (PHP5.4+).',
'ib' => '$x = ‏௫‏; // Tamil digit five - entered as string as PHP itself cannot deal with it as an integer.',
'ic' => '$x = ⁸₈; // Unicode superscript and subscript digit 8 - entered as a string as PHP itself cannot deal with these as integers.',
'f5' => '$x = acos(8); // = NAN',
'f6' => '$x = NAN; // = not a number',
'f7' => '$x = log(0); // = infinite',
'f8' => '$x = INF; // = infinite',
'f9' => '$x = 1.2345E8; // exponent notation float',
'fa' => '$x = ⅕; // Unicode character representing 1/5 - entered as string as PHP itself cannot deal with it as a float',
'f6' => '$x = NAN; // = Not a number.',
'f7' => '$x = log(0); // = Infinite.',
'f8' => '$x = INF; // = Infinite.',
'f9' => '$x = 1.2345E8; // Exponent notation float.',
'fa' => '$x = ⅕; // Unicode character representing 1/5 - entered as string as PHP itself cannot deal with it as a float.',
'sk' => '$x = "123, \"str\"\r\n";',
'sn' => '$x = "\f\t\r\n";',
'sp' => '$x = "\x7f\t\r\n"',
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Catch requests for static files (which have not been caught by htaccess).
*/
if ( ( isset( $_GET['page'], $_GET['phpversion'] ) && in_array( $_GET['page'], array( 'arithmetic', 'compare', 'test' ), true ) ) && preg_match( '`^php[457](?:\.[0-9]+){2}(?:-[0-9]|(?:alpha|beta|rc)(?:[0-9])?)?$`', $_GET['phpversion'] ) ) {
if ( ( isset( $_GET['page'], $_GET['phpversion'] ) && in_array( $_GET['page'], array( 'arithmetic', 'compare', 'test' ), true ) ) && preg_match( '`^php[457](?:\.[0-9]+){2}(?:-[0-9]|(?:alpha|beta|RC)(?:[0-9])?)?$`', $_GET['phpversion'] ) ) {
$file = APP_DIR . '/static_results/' . $_GET['page'] . '/' . $_GET['phpversion'] . '.html';
if ( is_file( $file ) ) {

Expand Down

0 comments on commit fd560ab

Please sign in to comment.