summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorEric Roberts <eric@cryode.com>2013-01-29 06:25:52 +0100
committerEric Roberts <eric@cryode.com>2013-01-29 06:25:52 +0100
commit032af98ab94482cc7c5b10013ec033acfdc34c74 (patch)
tree264c98acefbf494c8b858b8a282eaf4a9d3c78e5 /system
parentba67f3bb595817115a15f6c3249e41e7c85f2ce4 (diff)
Replace is_numeric() with ctype_digit()
Signed-off-by: Eric Roberts <eric@cryode.com>
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Pagination.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 562a2d3eb..438d6c477 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -449,7 +449,8 @@ class CI_Pagination {
// Are we using query strings?
if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
{
- $this->cur_page = (int) $CI->input->get($this->query_string_segment);
+ // Cast as string for use in ctype_digit() later.
+ $this->cur_page = (string) $CI->input->get($this->query_string_segment);
}
else
{
@@ -459,19 +460,25 @@ class CI_Pagination {
$this->uri_segment = count($CI->uri->segment_array());
}
- $this->cur_page = $CI->uri->segment($this->uri_segment);
+ $this->cur_page = (string) $CI->uri->segment($this->uri_segment);
// Remove any specified prefix/suffix from the segment.
- $this->cur_page = ($this->prefix !== '' OR $this->suffix !== '')
- ? (int) str_replace(array($this->prefix, $this->suffix), '', $this->cur_page)
- : (int) $this->cur_page;
+ if ($this->prefix !== '' OR $this->suffix !== '')
+ {
+ $this->cur_page = str_replace(array($this->prefix, $this->suffix), '', $this->cur_page);
+ }
}
// If something isn't quite right, back to the default base page.
- if ( ! is_numeric($this->cur_page) OR ($this->use_page_numbers && $this->cur_page === 0))
+ if ( ! ctype_digit($this->cur_page) OR ($this->use_page_numbers && (int) $this->cur_page === 0))
{
$this->cur_page = $base_page;
}
+ else
+ {
+ // Make sure we're using integers for comparisons later.
+ $this->cur_page = (int) $this->cur_page;
+ }
// Is the page number beyond the result range?
// If so, we show the last page.