From aab26a12a98ca99d956ef24e36c2262938631d73 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Tue, 11 Sep 2012 13:10:21 +0200 Subject: Better server test in redirect() of URL helper "Location" header bugs are specific to IIS; previous test was matching all HTTP servers under Windows. This test isn't perfect yet ($_SERVER['SERVER_SOFTWARE'], which corresponds to the "Server" header of HTTP response, might be missing), but there is no perfect test. "Refresh" method makes the window blank for quite a noticeable time, so let's not affect other servers because of IIS. --- system/helpers/url_helper.php | 2 +- user_guide_src/source/helpers/url_helper.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 57208c948..b1f5eccf1 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -534,7 +534,7 @@ if ( ! function_exists('redirect')) } // IIS environment likely? Use 'refresh' for better compatibility - if (DIRECTORY_SEPARATOR !== '/' && $method === 'auto') + if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== FALSE) { $method = 'refresh'; } diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 305454048..8de7817e4 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -303,7 +303,7 @@ link. The function will build the URL based on your config file values. The optional second parameter allows you to force a particular redirection method. The available methods are "location" or "refresh", with location -being faster but less reliable on Windows servers. The default is "auto", +being faster but less reliable on IIS servers. The default is "auto", which will attempt to intelligently choose the method based on the server environment. -- cgit v1.2.3-24-g4f1b From e3162843d9c2ca7e35f09741b6a361813473d4c5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 12 Sep 2012 14:44:26 +0300 Subject: Minor adjustments --- system/database/DB_driver.php | 2 +- user_guide_src/source/changelog.rst | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 9628e9a9e..e61af91b7 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1353,7 +1353,7 @@ abstract class CI_DB_driver { $trace = debug_backtrace(); foreach ($trace as $call) { - if (isset($call['file']) && strpos($call['file'], BASEPATH.'database') === FALSE && isset($call['class']) && strpos($call['class'], 'Loader') !== FALSE) + if (isset($call['file'], $call['class']) && strpos($call['file'], BASEPATH.'database') === FALSE && strpos($call['class'], 'Loader') !== FALSE) { // Found it - use a relative path for safety $message[] = 'Filename: '.str_replace(array(APPPATH, BASEPATH), '', $call['file']); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index f7dfc84ac..481afeee3 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -51,8 +51,8 @@ Release Date: Not Released - Changed detection of ``$view_folder`` so that if it's not found in the current path, it will now also be searched for under the application folder. - Path constants BASEPATH, APPPATH and VIEWPATH are now (internally) defined as absolute paths. - Updated email validation methods to use ``filter_var()`` instead of PCRE. - - Changed environment defaults to report all errors in 'development' and only fatal ones in 'testing' and 'production' but only display them in 'development'. - - Updated ip_address lengths from 16 to 45 for supporting ipv6 address on trackback library and captcha helper. + - Changed environment defaults to report all errors in *development* and only fatal ones in *testing*, *production* but only display them in *development*. + - Updated *ip_address* database field lengths from 16 to 45 for supporting IPv6 address on :doc:`Trackback Library ` and :doc:`Captcha Helper `. - Helpers @@ -144,7 +144,7 @@ Release Date: Not Released - Added capability for packages to hold database.php config files - Added subdrivers support (currently only used by PDO). - Added client compression support for MySQL and MySQLi. - - Removed Loader class from Database error to better find the likely culprit. + - Removed :doc:`Loader Class ` from Database error to better find the likely culprit. - Libraries @@ -201,7 +201,7 @@ Release Date: Not Released - Added support for setting custom attributes. - Deprecated usage of the "anchor_class" setting (use the new "attributes" setting instead). - Added $config['reuse_query_string'] to allow automatic repopulation of query string arguments, combined with normal URI segments. - - Removed the default `` `` from a number of the configuration variables. + - Removed the default `` `` from a number of the configuration variables. - Added the ability to use a proxy with the :doc:`XML-RPC Library `. - Core @@ -340,7 +340,7 @@ Bug fixes for 3.0 - Fixed a bug (#1613) - :doc:`Form Helper ` functions ``form_multiselect()``, ``form_dropdown()`` didn't properly handle empty array option groups. - Fixed a bug (#1605) - :doc:`Pagination Library ` produced incorrect *previous* and *next* link values. - Fixed a bug in SQLSRV's ``affected_rows()`` method where an erroneous function name was used. -- Fixed a bug (#1000) - Change syntax of $view_file to $_ci_view_file to prevent being overwritten by application. +- Fixed a bug (#1000) - Change syntax of ``$view_file`` to ``$_ci_view_file`` to prevent being overwritten by application. Version 2.1.2 ============= -- cgit v1.2.3-24-g4f1b From 88e3857ec2328e1dc4168c8343367d9d9e54d019 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Wed, 12 Sep 2012 18:45:21 +0200 Subject: Updated .travis.yml with new services param MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See http://about.travis-ci.org/blog/august-2012-upcoming-ci-environment-updates/ for details --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2496def0b..62acf05e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,11 @@ language: php php: - 5.3 - 5.4 + +services: + - mysql + - postgresql + - sqlite env: - DB=mysql -- cgit v1.2.3-24-g4f1b From 8280885499ca4b1cffacc9ad78a9eff07a84de25 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Thu, 13 Sep 2012 05:19:59 +0200 Subject: directory_map() was skipping files and directories named "0" Close #1757. Thanks @BennyC! --- system/helpers/directory_helper.php | 2 +- tests/codeigniter/helpers/directory_helper_test.php | 4 +++- user_guide_src/source/changelog.rst | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index e7d3b5e8a..7d6b6770e 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -62,7 +62,7 @@ if ( ! function_exists('directory_map')) while (FALSE !== ($file = readdir($fp))) { // Remove '.', '..', and hidden files [optional] - if ( ! trim($file, '.') OR ($hidden === FALSE && $file[0] === '.')) + if ($file === '.' OR $file === '..' OR ($hidden === FALSE && $file[0] === '.')) { continue; } diff --git a/tests/codeigniter/helpers/directory_helper_test.php b/tests/codeigniter/helpers/directory_helper_test.php index 176ff1d78..c39ccd8d0 100644 --- a/tests/codeigniter/helpers/directory_helper_test.php +++ b/tests/codeigniter/helpers/directory_helper_test.php @@ -19,6 +19,7 @@ class Directory_helper_test extends CI_TestCase { 'benchmark.html' => '', 'database' => array('active_record.html' => '', 'binds.html' => ''), 'email.html' => '', + '0' => '', '.hiddenfile.txt' => '' ) ); @@ -30,7 +31,8 @@ class Directory_helper_test extends CI_TestCase { 'libraries' => array( 'benchmark.html', 'database' => array('active_record.html', 'binds.html'), - 'email.html' + 'email.html', + '0' ) ); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 481afeee3..66dd0ea05 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -341,6 +341,7 @@ Bug fixes for 3.0 - Fixed a bug (#1605) - :doc:`Pagination Library ` produced incorrect *previous* and *next* link values. - Fixed a bug in SQLSRV's ``affected_rows()`` method where an erroneous function name was used. - Fixed a bug (#1000) - Change syntax of ``$view_file`` to ``$_ci_view_file`` to prevent being overwritten by application. +- Fixed a bug (#1757) - :doc:`Directory Helper ` function ``directory_map()`` was skipping files and directories named *0*. Version 2.1.2 ============= -- cgit v1.2.3-24-g4f1b From 431afaedaea55bc20716babe21557fd2b0ad531c Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 14 Sep 2012 00:57:41 +0700 Subject: Set code-coverage limit scope Signed-off-by: Taufan Aditya --- tests/travis/mysql.phpunit.xml | 2 +- tests/travis/pdo/mysql.phpunit.xml | 2 +- tests/travis/pdo/pgsql.phpunit.xml | 2 +- tests/travis/pdo/sqlite.phpunit.xml | 2 +- tests/travis/pgsql.phpunit.xml | 2 +- tests/travis/sqlite.phpunit.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/travis/mysql.phpunit.xml b/tests/travis/mysql.phpunit.xml index 38c8eba48..06d4a011b 100644 --- a/tests/travis/mysql.phpunit.xml +++ b/tests/travis/mysql.phpunit.xml @@ -18,7 +18,7 @@ - + ../../system diff --git a/tests/travis/pdo/mysql.phpunit.xml b/tests/travis/pdo/mysql.phpunit.xml index c3113a66f..7121edc45 100644 --- a/tests/travis/pdo/mysql.phpunit.xml +++ b/tests/travis/pdo/mysql.phpunit.xml @@ -18,7 +18,7 @@ - + ../../../system diff --git a/tests/travis/pdo/pgsql.phpunit.xml b/tests/travis/pdo/pgsql.phpunit.xml index 232025523..df3ff986e 100644 --- a/tests/travis/pdo/pgsql.phpunit.xml +++ b/tests/travis/pdo/pgsql.phpunit.xml @@ -18,7 +18,7 @@ - + ../../../system diff --git a/tests/travis/pdo/sqlite.phpunit.xml b/tests/travis/pdo/sqlite.phpunit.xml index 3d1256721..7d867f6d1 100644 --- a/tests/travis/pdo/sqlite.phpunit.xml +++ b/tests/travis/pdo/sqlite.phpunit.xml @@ -18,7 +18,7 @@ - + ../../../system diff --git a/tests/travis/pgsql.phpunit.xml b/tests/travis/pgsql.phpunit.xml index 51e433d76..bfddbf6b5 100644 --- a/tests/travis/pgsql.phpunit.xml +++ b/tests/travis/pgsql.phpunit.xml @@ -18,7 +18,7 @@ - + ../../system diff --git a/tests/travis/sqlite.phpunit.xml b/tests/travis/sqlite.phpunit.xml index 701165734..75c946aee 100644 --- a/tests/travis/sqlite.phpunit.xml +++ b/tests/travis/sqlite.phpunit.xml @@ -18,7 +18,7 @@ - + ../../system -- cgit v1.2.3-24-g4f1b From 5f733c4fd1369a185804cd7b6d27debc50ab1826 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sat, 15 Sep 2012 10:48:17 +0200 Subject: Update reserved names documentation - EXT removed in 079fbfcde095230f304e889217f897031a948f61 - VIEWPATH added in 8eef9c77512d4fad5357d3cbda83b89f844d7d16 --- user_guide_src/source/general/reserved_names.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/reserved_names.rst b/user_guide_src/source/general/reserved_names.rst index 5ce7fc2ff..3354375c5 100644 --- a/user_guide_src/source/general/reserved_names.rst +++ b/user_guide_src/source/general/reserved_names.rst @@ -45,11 +45,11 @@ Constants --------- - ENVIRONMENT -- EXT - FCPATH - SELF - BASEPATH - APPPATH +- VIEWPATH - CI_VERSION - FILE_READ_MODE - FILE_WRITE_MODE -- cgit v1.2.3-24-g4f1b From b16dd29147fa8155cb9d9dadfb7c587aef81d772 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sun, 16 Sep 2012 19:11:39 +0200 Subject: Minor change in Output cache file check Won't change anything in practice, but robuster (and faster) if ever a cache file would be invalid --- system/core/Output.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/Output.php b/system/core/Output.php index 9842f834d..847c61e3e 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -552,7 +552,7 @@ class CI_Output { fclose($fp); // Strip out the embedded timestamp - if ( ! preg_match('/\d+TS--->/', $cache, $match)) + if ( ! preg_match('/^\d+TS--->/', $cache, $match)) { return FALSE; } -- cgit v1.2.3-24-g4f1b From 239e0e598f0b9462e195db5da658095eb70cf6e3 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sun, 16 Sep 2012 19:16:33 +0200 Subject: Better method for getting Output cache file embedded timestamp Faster, shorter code --- system/core/Output.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/core/Output.php b/system/core/Output.php index 847c61e3e..052367ed6 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -552,13 +552,13 @@ class CI_Output { fclose($fp); // Strip out the embedded timestamp - if ( ! preg_match('/^\d+TS--->/', $cache, $match)) + if ( ! preg_match('/^(\d+)TS--->/', $cache, $match)) { return FALSE; } $last_modified = filemtime($cache_path); - $expire = str_replace('TS--->', '', $match[0]); + $expire = $match[1]; // Has the file expired? if ($_SERVER['REQUEST_TIME'] >= $expire && is_really_writable($cache_path)) -- cgit v1.2.3-24-g4f1b From 530b946191c68886b6e156004742e785bfeef8cc Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 17 Sep 2012 14:18:07 +0200 Subject: redirect() documentation: add a note for IIS users --- user_guide_src/source/helpers/url_helper.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 8de7817e4..1987dfb72 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -325,3 +325,7 @@ engine purposes. The default Response Code is 302. The third parameter is .. note:: For very fine grained control over headers, you should use the `Output Library ` set_header() function. + +.. note:: To IIS users: if you hide the `Server` HTTP header, the "auto" + method won't detect IIS, in that case it is advised you explicitly + use the "refresh" method. -- cgit v1.2.3-24-g4f1b From 035f499a59f9a226fa1223387074ef4e28abd4bb Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 17 Sep 2012 14:45:21 +0200 Subject: Changelog: add entry for the change in "auto" method of redirect() --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index f7dfc84ac..ed1b33835 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -67,6 +67,7 @@ Release Date: Not Released - ``anchor_popup()`` will now fill the "href" attribute with the URL and its JS code will return false instead. - Added JS window name support to ``anchor_popup()`` function. - Added support (auto-detection) for HTTP/1.1 response code 303 in ``redirect()``. + - "auto" method in ``redirect()`` now chooses the "refresh" method only on IIS servers, instead of all servers on Windows. - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper `. - Changed ``humanize()`` to include a second param for the separator. - Refactored ``plural()`` and ``singular()`` to avoid double pluralization and support more words. -- cgit v1.2.3-24-g4f1b