Permalink
Browse files

Add cross version constants.

Add constants for older versions of PHP which may be missing them.
Fixes #1975
  • Loading branch information...
1 parent f91c755 commit fc389e8155c416cae4e4b926fb68aca4179ae394 @markstory markstory committed Sep 8, 2011
Showing with 21 additions and 1 deletion.
  1. +21 −1 cake/basics.php
View
22 cake/basics.php
@@ -34,6 +34,26 @@
define('MONTH', 30 * DAY);
define('YEAR', 365 * DAY);
/**
+ * Patch old versions of PHP4.
+ */
+if (!defined('PHP_EOL')) {
+ switch (strtoupper(substr(PHP_OS, 0, 3))) {
+ case 'WIN':
+ define('PHP_EOL', "\r\n");
+ break;
+ default:
+ define('PHP_EOL', "\n");
+ }
+}
+
+/**
+ * Patch PHP4 and PHP5.0
+ */
+if (!defined('DATE_RFC2822')) {
+ define('DATE_RFC2822', 'D, d M Y H:i:s O');
+}
+
+/**
* Patch for PHP < 5.0
*/
if (!function_exists('clone')) {
@@ -936,4 +956,4 @@ function ife($condition, $val1 = null, $val2 = null) {
}
return $val2;
}
-?>
+?>

0 comments on commit fc389e8

Please sign in to comment.