summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2017-11-15 13:37:24 +0100
committerAndrey Andreev <narf@devilix.net>2017-11-15 13:37:24 +0100
commit432a9130059873551d1cff3e40d1d8432f552b96 (patch)
treeaabda9878719055ea2ab6c375c29dacb792b5f2f
parent212df3650c30ce93219168d3305f374d8b8ece37 (diff)
parentee8324368f2844aae0d558f1d194419a2181c281 (diff)
Merge branch '3.1-stable' into develop
Note: This intentionally reverts ee8324368f2844aae0d558f1d194419a2181c281
-rw-r--r--system/core/Loader.php8
-rw-r--r--system/core/Model.php12
-rw-r--r--system/helpers/url_helper.php2
-rw-r--r--system/libraries/Email.php4
-rw-r--r--tests/codeigniter/helpers/url_helper_test.php9
-rw-r--r--user_guide_src/source/changelog.rst2
6 files changed, 21 insertions, 16 deletions
diff --git a/system/core/Loader.php b/system/core/Loader.php
index fd43ebbe1..5b051e1a8 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -303,6 +303,8 @@ class CI_Loader {
{
throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model");
}
+
+ log_message('info', 'CI_Model class loaded');
}
elseif ( ! class_exists('CI_Model', FALSE))
{
@@ -317,6 +319,8 @@ class CI_Loader {
{
throw new RuntimeException($app_path.$class.".php exists, but doesn't declare class ".$class);
}
+
+ log_message('info', config_item('subclass_prefix').'Model class loaded');
}
}
@@ -351,7 +355,9 @@ class CI_Loader {
}
$this->_ci_models[] = $name;
- $CI->$name = new $model();
+ $model = new $model();
+ $CI->$name = $model;
+ log_message('info', 'Model "'.get_class($model).'" initialized');
return $this;
}
diff --git a/system/core/Model.php b/system/core/Model.php
index c809e7b84..691053a9c 100644
--- a/system/core/Model.php
+++ b/system/core/Model.php
@@ -49,18 +49,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class CI_Model {
/**
- * Class constructor
- *
- * @return void
- */
- public function __construct()
- {
- log_message('info', 'Model Class Initialized');
- }
-
- // --------------------------------------------------------------------
-
- /**
* __get magic
*
* Allows models to access CI's loaded classes using the same
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 421b3bad5..2e09534f5 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -393,7 +393,7 @@ if ( ! function_exists('auto_link'))
function auto_link($str, $type = 'both', $popup = FALSE)
{
// Find and replace any URLs.
- if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w/?#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER))
+ if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[a-z0-9]+(-+[a-z0-9]+)*(\.[a-z0-9]+(-+[a-z0-9]+)*)+(/([^\s()<>;]+\w)?/?)?#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER))
{
// Set our target HTML if using popup links.
$target = ($popup) ? ' target="_blank"' : '';
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index f115d9f40..6e28989cb 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1014,7 +1014,7 @@ class CI_Email {
*/
public function valid_email($email)
{
- if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@'))
+ if (function_exists('idn_to_ascii') && strpos($email, '@'))
{
$email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46);
}
@@ -1821,7 +1821,7 @@ class CI_Email {
*/
protected function _validate_email_for_shell(&$email)
{
- if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@'))
+ if (function_exists('idn_to_ascii') && strpos($email, '@'))
{
$email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46);
}
diff --git a/tests/codeigniter/helpers/url_helper_test.php b/tests/codeigniter/helpers/url_helper_test.php
index f33189a3a..5f936568b 100644
--- a/tests/codeigniter/helpers/url_helper_test.php
+++ b/tests/codeigniter/helpers/url_helper_test.php
@@ -87,4 +87,13 @@ class Url_helper_test extends CI_TestCase {
}
}
+ // --------------------------------------------------------------------
+
+ public function test_issue_5331()
+ {
+ $this->assertEquals(
+ 'this is some text that includes '.safe_mailto('www.email@domain.com').' which is causing an issue',
+ auto_link('this is some text that includes www.email@domain.com which is causing an issue')
+ );
+ }
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 56e587e9b..69d185d50 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -128,6 +128,7 @@ Release Date: Not Released
- Updated :doc:`Form Validation Library <libraries/form_validation>` rule ``valid_email`` to use ``INTL_IDNA_VARIANT_UTS46`` for non-ASCII domain names.
- Updated :doc:`Email Library <libraries/email>` to use ``INTL_IDNA_VARIANT_UTS46`` for non-ASCII domain names.
+ - Updated :doc:`Loader Library <libraries/loader>` method ``model()`` to log both ``CI_Model`` class loading and individual models' initialization.
- Deprecated usage of :doc:`CAPTCHA Helper <helpers/captcha_helper>` function :php:func:`create_captcha()` with parameters other than ``$data``.
Bug fixes for 3.1.7
@@ -138,6 +139,7 @@ Bug fixes for 3.1.7
- Fixed a bug (#5278) - :doc:`URL Helper <helpers/url_helper>` function :php:func:`auto_link()` didn't detect trailing slashes in URLs.
- Fixed a regression (#5282) - :doc:`Query Builder <database/query_builder>` method ``count_all_results()`` breaks ``ORDER BY`` clauses for subsequent queries.
- Fixed a bug (#5279) - :doc:`Query Builder <database/query_builder>` didn't account for already escaped identifiers while applying database name prefixes.
+- Fixed a bug (#5331) - :doc:`URL Helper <helpers/url_helper>` function :php:func:`auto_link()` converted e-mail addresses starting with 'www.' to both "url" and "email" links.
Version 3.1.6
=============