<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">

    <title type="text">CodeIgniter Forums</title>
    <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/" />
    <link rel="self" type="application/atom+xml" href="http://codeigniter.com/forums/atom/" />
    <updated></updated>
    <rights>Copyright (c) 2008</rights>
    <generator uri="http://www.pmachine.com/" version="1.6.3">ExpressionEngine</generator>
    <id>tag:codeigniter.com,2008:07:26</id>


    <entry>
      <title>double last record when using foreach($query&#45;&amp;gt;result() as $item)</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/86370/" />      
      <id>tag:codeigniter.com,2008:forums/viewthread/.86370</id>
      <published>2008-07-26T11:41:39Z</published>
      <updated></updated>
      <author><name>Galford</name></author>
      <content type="html">
      <![CDATA[
        <p>Hi
</p>
<p>
I have something like that
</p>
<p>
in $query is simple select * from table
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #007700">foreach(</span><span style="color: #0000BB">$query</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">result</span><span style="color: #007700">() as </span><span style="color: #0000BB">$item</span><span style="color: #007700">)<br /></span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;$content </span><span style="color: #007700">.= </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">view</span><span style="color: #007700">(</span><span style="color: #DD0000">'contact_element_show'</span><span style="color: #007700">, </span><span style="color: #0000BB">$item</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#125;</span>
</code></div><p>
</p>
<p>
when I check the result its double last row from table.
</p>
<p>
Is it a bug?
</p>
<p>
I use CI 1.6.3
</p>
<p>
Regards
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Is it a bug at $this&#45;&amp;gt;input&#45;&amp;gt;post function &#63;</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/86183/" />      
      <id>tag:codeigniter.com,2008:forums/viewthread/.86183</id>
      <published>2008-07-24T12:44:21Z</published>
      <updated></updated>
      <author><name>mihu</name></author>
      <content type="html">
      <![CDATA[
        <p>hmm ... I am not sure this is a bug or not. Let me try to explain what happened here.
</p>
<p>
http://codeigniter.com/user_guide/libraries/input.html
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">input</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">post</span><span style="color: #007700">(</span><span style="color: #DD0000">'some_data'</span><span style="color: #007700">, </span><span style="color: #0000BB">TRUE</span><span style="color: #007700">);</span>
</code></div><p>
I was trying to run through XSS filter by setting 2nd parameter to &#8220;true&#8221;.
</p>
<p>
Somehow the XSS filter convert or encoded my string to other encoded characters which trigger a sql error due to using diff. encoded in the same string.
</p>
<p>
If you enter &#8220;Ê&#8221; at input text field and submit, you will get the other encoded character.
<br />
like http://en.wikipedia.org/wiki/ÃŠ
</p>
<p>
Please let me know if you need other information. :D
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Quotes in mime type when uploading</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/86033/" />      
      <id>tag:codeigniter.com,2008:forums/viewthread/.86033</id>
      <published>2008-07-23T08:52:19Z</published>
      <updated></updated>
      <author><name>Michael DOUBEZ</name></author>
      <content type="html">
      <![CDATA[
        <p>Hello,
</p>
<p>
When trying to upload a file, the mime type is not recognized because of quotes under FF3 (itworks under IE).
</p>
<p>
I have already filled a bug report:
<br />
http://codeigniter.com/bug_tracker/bug/problem_in_mimetype_recognition_under_ff3/
<br />
And I have been prompted by Derek Allard to start this thread.
</p>
<p>
To illustrate the problem, I have setup a pristine Code Igniter 1.6.2 on
<br />
http://michael.doubez.free.fr/index.php/test
</p>
<p>
The test is trying to upload a file with .bin extension with FF3.
<br />
The controller used (more or less) is:
<br />
http://michael.doubez.free.fr/test.txt
</p>
<p>
The output of:
<br />
echo $this-&gt;upload-&gt;display_errors();
<br />
echo ol($this-&gt;upload-&gt;data());
<br />
is
<br />
&lt;&lt;&lt;
<br />
The filetype you are attempting to upload is not allowed.
</p>
<p>
1. test.bin
<br />
2. &#8220;application/octet-stream&#8221;
<br />
... 
<br />
&gt;&gt;W
<br />
See the quotes in the mime type reporting.
</p>
<p>
Note: I have changed my mimes.php file
<br />
  &#8216;bin&#8217;    =&gt; &#8216;application/octet-stream&#8217;,
</p>
<p>
Cheers
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Model class&#45; and member naming</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/77377/" />      
      <id>tag:codeigniter.com,2008:forums/viewthread/.77377</id>
      <published>2008-04-21T03:16:23Z</published>
      <updated>2008-04-21T05:52:22Z</updated>
      <author><name>mark17</name></author>
      <content type="html">
      <![CDATA[
        <p>L.S.
</p>
<p>
The following fatal error is what i get in at least CodeIgniter 1.6.1, perhaps it&#8217;s present in older versions but haven&#8217;t tried it.
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">Fatal error</span><span style="color: #007700">: </span><span style="color: #0000BB">Cannot access private property Test</span><span style="color: #007700">::</span><span style="color: #0000BB">$test in </span><span style="color: #007700">/</span><span style="color: #0000BB">home</span><span style="color: #007700">/</span><span style="color: #0000BB">markus</span><span style="color: #007700">/</span><span style="color: #0000BB">public_html</span><span style="color: #007700">/</span><span style="color: #0000BB">brochureselectie</span><span style="color: #007700">.</span><span style="color: #0000BB">nl</span><span style="color: #007700">/</span><span style="color: #0000BB">trunk</span><span style="color: #007700">/</span><span style="color: #0000BB">sys</span><span style="color: #007700">/</span><span style="color: #0000BB">libraries</span><span style="color: #007700">/</span><span style="color: #0000BB">Model</span><span style="color: #007700">.</span><span style="color: #0000BB">php on line 69</span>
</code></div><p>
</p>
<p>
This is produced when some model attempts to set a classvariable with the same name, like the snippet below.
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">class </span><span style="color: #0000BB">Test </span><span style="color: #007700">extends </span><span style="color: #0000BB">Model &#123;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;private $test </span><span style="color: #007700">= </span><span style="color: #0000BB">NULL</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">public </span><span style="color: #007700">function </span><span style="color: #0000BB">__construct</span><span style="color: #007700">() </span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parent</span><span style="color: #007700">::</span><span style="color: #0000BB">__construct</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">test </span><span style="color: #007700">= </span><span style="color: #DD0000">'TEST'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;public </span><span style="color: #007700">function </span><span style="color: #0000BB">getTest</span><span style="color: #007700">() </span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">return </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">test</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /><br />&#125;<br /><br />?&gt;</span>
</code></div><p>
</p>
<p>
I&#8217;m unsure whether or not this is an existing and an already reported bug, although a search for model related issues did not result in any bug alike.
</p>
<p>
Any thoughts on this one? It should not be a problem to have ambiguous naming within some class. This could also cause dynamically generated errors when some code using __set() methods to dynamically assign new variables to the scope.
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">class </span><span style="color: #0000BB">Test </span><span style="color: #007700">extends </span><span style="color: #0000BB">MY_Model &#123;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//private $test = NULL;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">public </span><span style="color: #007700">function </span><span style="color: #0000BB">__construct</span><span style="color: #007700">() </span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parent</span><span style="color: #007700">::</span><span style="color: #0000BB">__construct</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">test </span><span style="color: #007700">= </span><span style="color: #DD0000">'TEST'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;public </span><span style="color: #007700">function </span><span style="color: #0000BB">getTest</span><span style="color: #007700">() </span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">return </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">test</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;public </span><span style="color: #007700">function </span><span style="color: #0000BB">__set</span><span style="color: #007700">(</span><span style="color: #0000BB">$b</span><span style="color: #007700">, </span><span style="color: #0000BB">$c</span><span style="color: #007700">) </span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$b</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print </span><span style="color: #DD0000">'&lt;p&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /><br />&#125;<br /><br />?&gt;</span>
</code></div><p>
</p>
<p>
The last snippet will generate the following output, possibly because __set will catch not only my assignment of $this-&gt;test but a lot more internal stuff. Please try&#8230;
</p>
<p>
Regards,
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Validation in autoload PHP 4 (Fix suggested)</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/69084/" />      
      <id>tag:codeigniter.com,2008:forums/viewthread/.69084</id>
      <published>2008-01-16T21:05:14Z</published>
      <updated></updated>
      <author><name>Seppo</name></author>
      <content type="html">
      <![CDATA[
        <p>This is an old bug&#8230; It has been reported many times, and currently itÂ´s in the tracker with the ID <a href="http://codeigniter.com/bug_tracker/bug/3175/">3175</a>
</p>
<p>
The original problem is that in the view you get an empty error_string even if the validation fails.
<br />
Tracking it down, I found out that the problem was that PHP was generating a copy of the autoloaded class, so they were different in the controller class and in the loader class (where the $this variable point, inside the views).
<br />
A quick example, to show this
</p>
<p>
</p><div class="codeblock"><code>
// system/application/config/autoload.php<br /></span><span style="color: #0000BB">$autoload&#91;</span><span style="color: #DD0000">'libraries'</span><span style="color: #0000BB">&#93; </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'validation'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// system/application/controllers/bug3175.php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">Bug3175 </span><span style="color: #007700">extends </span><span style="color: #0000BB">Controller &#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">function </span><span style="color: #0000BB">Bug3175</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parent</span><span style="color: #007700">::</span><span style="color: #0000BB">Controller</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">function </span><span style="color: #0000BB">index</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">validation</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">hello_world </span><span style="color: #007700">= </span><span style="color: #DD0000">'abcde'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">view</span><span style="color: #007700">(</span><span style="color: #DD0000">'bug3175'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br />&#125;<br /><br /></span><span style="color: #FF8000">// system/application/controllers/bug3175.php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">validation</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">hello_world</span><span style="color: #007700">;</span>
</code></div><p>
</p>
<p>
In PHP 4 (IÂ´ve tested this in 4.3.9 and 4.4.7) throws a notice for the undefined variable. In PHP 5 (5.0.0, 5.1.6, 5.2.5) it prints &#8220;abcde&#8221;, as expected.
</p>

<p>
After tracking this bug inside all core IÂ´ve finally reached to system/libraries/Controller.php, on line 87. After $this-&gt;_ci_autoloader(); IÂ´ve added
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">foreach (</span><span style="color: #0000BB">array_keys</span><span style="color: #007700">(</span><span style="color: #0000BB">get_object_vars</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">)) as </span><span style="color: #0000BB">$attribute</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if (</span><span style="color: #0000BB">is_object</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$attribute </span><span style="color: #007700">=&amp; </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;</span>
</code></div><p>
which syncronize back the references between the Loader and the Controller.
</p>
<p>
PLEASE EVERYONE, test this on all PHP versions you can and submit the result, so we can finally fix this bug&#8230;
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Logging fatal errors</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/85949/" />      
      <id>tag:codeigniter.com,2008:forums/viewthread/.85949</id>
      <published>2008-07-22T13:45:18Z</published>
      <updated>2008-07-22T15:00:27Z</updated>
      <author><name>dmorin</name></author>
      <content type="html">
      <![CDATA[
        <p>I have CI setup to log errors, however, I&#8217;ve found that some php errors never seem to get logged, usually fatal errors.&nbsp; One example is if the script tries to exceed its memory limits it will die and never be logged.
</p>
<p>
What are others doing to monitor for these failures?&nbsp; Is there anything that can be done to get these errors into the CI log or is the only other option to just monitor the apache log as well?
</p>
<p>
Thanks,
<br />
Dan
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>CI Stupidly Kills GET Data</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/47309/" />      
      <id>tag:codeigniter.com,2007:forums/viewthread/.47309</id>
      <published>2007-01-04T04:02:48Z</published>
      <updated></updated>
      <author><name>CI Kristian</name></author>
      <content type="html">
      <![CDATA[
        <p>One of the things I like the most about CI is that it doesn&#8217;t force you to write code in strict and specific ways.. it doesn&#8217;t shove its way of doing things down your neck&#8230; it doesn&#8217;t sneak around doing things behind your back.. you&#8217;re the coder and you can code however you like.
</p>
<p>
<b>THE EXCEPTION: $_GET</b>
</p>
<p>
The CI philosophy seems to be: worship the POST method and kill GET
</p>
<blockquote><p><b>Code Igniter User Guide</b>
</p>
<p>
GET data is simply disallowed by Code Igniter since the system utilizes URI segments rather than traditional URL query strings (unless you have the query string option enabled in your config file). The global <b>GET array is unset by the Input class</b> during system initialization.</p></blockquote>

<p>
This is DUMB! It seems like this fundamental design decision was taken without any thought or it was assumed that GET vars (query string e.g. ?var1=value&amp;var2=value ) could not coexist with the segment approach (e.g.&nbsp; http://localhost/ci-get-fixed/seg1/seg2/?var1=value&amp;var2=value ).. like it had to be one or the other.
</p>
<p>
<b>THIS IS SUCH AN ANNOYING BUG!</b>  <img src="http://ellislab.com/images/smileys/vampire.gif" width="19" height="19" alt="vampire" style="border:0;" /> 
</p>
<p>
It&#8217;s easy to fix but the fact that CI works this way as standard is sooo stupid!
</p>
<p>
Please fix this bug and set Code Igniter free <img src="http://ellislab.com/images/smileys/smile.gif" width="19" height="19" alt="smile" style="border:0;" />
</p>
<p>
<b><u>EDIT/CLARIFICATION:</u></b>
</p>
<p>
The URI segment approach is great for links but form submissions donâ€™t work this way (without client-side scripting).
</p>
<p>
http://localhost/store/search?q=search+terms
</p>
<p>
GET and POST have different uses as defined by the HTTP standard (RFC 2616). Submitting all form data using the POST method is improper and has adverse effects.
<br />
Both GET and POST have their place.
</p>
<p>
<b><u>RELATED THREADS:</u></b>
</p>
<p>
Thread: <a href="http://codeigniter.com/forums/viewthread/47153/">GET params (strange behaviour) ?</a>
</p>
<p>
Thread: <a href="http://codeigniter.com/forums/viewthread/46809/">Input enhancements - (optionally) allow GET values</a>
</p>
<p>
Thread: <a href="http://codeigniter.com/forums/viewthread/47107/">IMPLEMENTED: get() method from input class, better routing without mod_rewrite, bug fix for CI_Input methods</a>
</p>
<p>
Thread: <a href="http://codeigniter.com/forums/viewthread/47192/">How to create mix urls (Segment + Querystring)</a>
</p>
<p>
Thread: <a href="http://codeigniter.com/forums/viewthread/47334/">GET variables gone in 1.5.1 ?</a>
</p>
<p>
Thread: <a href="http://codeigniter.com/forums/viewthread/46682/">$_GET value to controller</a>
</p>
<p>
Thread: <a href="http://codeigniter.com/forums/viewthread/47150/">support for less than two GET parameters within the url</a>
</p>
<p>
Thread: <a href="http://codeigniter.com/forums/viewthread/46399/">Silly Problem passing variables between controllers</a>
</p>
<p>
Thread: <a href="http://codeigniter.com/forums/viewthread/44812/">$_GET[] causing problems with 1.3</a>
</p>
<p>
...
<br />
I would link to a forum search but GET variables (query strings) aren&#8217;t supported  <img src="http://ellislab.com/images/smileys/wink.gif" width="19" height="19" alt="wink" style="border:0;" />
<br />
<a href="http://codeigniter.com/forums/do_search/?keywords=query+string">http://codeigniter.com/forums/do_search/?keywords=query+string</a>
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>CI + FireFox3 bug: Checking file type with File Uploading Class failes in FireFox3</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/85806/" />      
      <id>tag:codeigniter.com,2008:forums/viewthread/.85806</id>
      <published>2008-07-21T09:32:44Z</published>
      <updated>2008-07-21T18:19:04Z</updated>
      <author><name>Isos</name></author>
      <content type="html">
      <![CDATA[
        <p>Hello .. I noticed a strange bug (I may say it&#8217;s a firefox3 bug) but code igniter can&#8217;t handle it.
</p>
<p>
The bug is in the mime type detected. Let&#8217;s say we are trying to upload a .doc file using CI File Uploading Class, it will check $_FILES[$file][&#8217;type&#8217;] and then checks if it matches mimes values of the specified mime types keys as doc|pdf ... 
</p>
<p>
So the problem is that in FireFox3, (which is not an issue in Firefox 2 or opera or any other browser) the var $this-&gt;file_type receives  $_FILES[$file][&#8217;type&#8217;] as &#8220;application/msword&#8221; (with double quotes) and adds backslash to be \"application/msword\".
</p>
<p>
So then the function is_allowed_filetype() checks if it maches $mime[&#8217;doc&#8217;] but since it has (\&#8221; \") match fails, and thus I get the report message that says filetype is not allowed.
</p>
<p>
My fix in my extended class is as following:
</p>
<p>
When defining $this-&gt;file_type:
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">file_type </span><span style="color: #007700">= </span><span style="color: #0000BB">preg_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">"/^(.+?);.*$/"</span><span style="color: #007700">, </span><span style="color: #DD0000">"\\1"</span><span style="color: #007700">, </span><span style="color: #0000BB">$_FILES&#91;$field&#93;&#91;</span><span style="color: #DD0000">'type'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">file_type </span><span style="color: #007700">= </span><span style="color: #0000BB">strtolower</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">file_type</span><span style="color: #007700">); </span><span style="color: #FF8000">// trim for firefox3</span>
</code></div><p>
I simply append the following:
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">file_type </span><span style="color: #007700">= </span><span style="color: #0000BB">trim</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">file_type</span><span style="color: #007700">,</span><span style="color: #DD0000">'\"'</span><span style="color: #007700">);</span>
</code></div><p>
</p>
<p>
With this it works.
</p>
<p>
Also I&#8217;d like to share with the community a script that I appended to the previous script that detects the file type using finfo (if it&#8217;s installed on the server) cuz detecting the file type using $_FILES[$file][&#8217;type&#8217;] isn&#8217;t a good idea as it can be modified by the user.
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #007700">if (</span><span style="color: #0000BB">function_exists</span><span style="color: #007700">(</span><span style="color: #DD0000">'finfo_open'</span><span style="color: #007700">)) </span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$finfo </span><span style="color: #007700">= @</span><span style="color: #0000BB">finfo_open</span><span style="color: #007700">(</span><span style="color: #0000BB">FILEINFO_MIME</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (</span><span style="color: #0000BB">$finfo </span><span style="color: #007700">!== </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">) </span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$file_type </span><span style="color: #007700">= @</span><span style="color: #0000BB">finfo_file&#40;$finfo</span><span style="color: #007700">, </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">file_temp&#41;</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ((</span><span style="color: #0000BB">$file_type </span><span style="color: #007700">!== </span><span style="color: #0000BB">FALSE&#41; </span><span style="color: #007700">&amp;&amp; </span><span style="color: #0000BB">is_string</span><span style="color: #007700">(</span><span style="color: #0000BB">$file_type</span><span style="color: #007700">) &amp;&amp; (</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">$file_type</span><span style="color: #007700">)&gt;</span><span style="color: #0000BB">0</span><span style="color: #007700">)) </span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">file_type </span><span style="color: #007700">= </span><span style="color: #0000BB">$file_type</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">finfo_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$finfo</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /> &#125;</span>
</code></div><p>
</p>
<p>
So as for the bug, I hope CI developers would consider that in bug fixing of the next release.
</p>
<p>
Thanks.
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>$this&#45;&amp;gt;uri&#45;&amp;gt;rsegments    versus    $this&#45;&amp;gt;uri&#45;&amp;gt;segments:&amp;nbsp;      subdirectory gets lost&#63;</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/72313/" />      
      <id>tag:codeigniter.com,2008:forums/viewthread/.72313</id>
      <published>2008-02-21T15:10:30Z</published>
      <updated></updated>
      <author><name>uprocka</name></author>
      <content type="html">
      <![CDATA[
        <p>Hello I use the resegment(n) function to get data from the routed uri.
</p>
<p>
the problem is when there wasn a routing the VAR $this-&gt;uri-&gt;rsegments holds different data than $this-&gt;uri-&gt;segments - that seems to be wrongto me.
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">URI</span><span style="color: #007700">: /</span><span style="color: #0000BB">index</span><span style="color: #007700">.</span><span style="color: #0000BB">php</span><span style="color: #007700">/</span><span style="color: #0000BB">admin</span><span style="color: #007700">/</span><span style="color: #0000BB">order</span><span style="color: #007700">/</span><span style="color: #0000BB">1000</span><span style="color: #007700">/</span><span style="color: #0000BB">invoice</span><span style="color: #007700">/<br /></span><span style="color: #FF8000">//no routing defined in routes.php!<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">uri</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">segments</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// Array ( &#91;1&#93; =&gt; admin &#91;2&#93; =&gt; order &#91;3&#93; =&gt; 1000 &#91;4&#93; =&gt; invoice ) <br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">uri</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rsegments</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// Array ( &#91;1&#93; =&gt; order &#91;2&#93; =&gt; 1000 &#91;3&#93; =&gt; invoice )</span>
</code></div><p>
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Database Debuging issue, error not logged</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/85781/" />      
      <id>tag:codeigniter.com,2008:forums/viewthread/.85781</id>
      <published>2008-07-21T03:12:04Z</published>
      <updated></updated>
      <author><name>XtraFile</name></author>
      <content type="html">
      <![CDATA[
        <p>When queries fail(I&#8217;m personally using AR) the database code attempts to log the exact error message. Unfortunately on some database engines(MySQL, MySQLi, etc.) once you retrieve the error message it clears the message for any future attempts to access it via included functions. This results in log messages like the following:</p><div class="codeblock"><code>
<span style="color: #0000BB">ERROR </span><span style="color: #007700">- </span><span style="color: #0000BB">2008</span><span style="color: #007700">-</span><span style="color: #0000BB">07</span><span style="color: #007700">-</span><span style="color: #0000BB">21 03</span><span style="color: #007700">:</span><span style="color: #0000BB">51</span><span style="color: #007700">:</span><span style="color: #0000BB">13 </span><span style="color: #007700">--&gt; </span><span style="color: #0000BB">Query error</span><span style="color: #007700">:</span>
</code></div><p>
</p>
<p>
The log is missing the actual error returned from the engine. To fix this you have to use the first variable that accesses the error message, in this case $error_msg in database/DB_driver.php on line 316.
</p>
<p>
The logging attempt on line 325 calls the _error_message() function again, returning an empty string on some systems. This is resolved by changing that line to the following:</p><div class="codeblock"><code>
<span style="color: #0000BB">log_message</span><span style="color: #007700">(</span><span style="color: #DD0000">'error'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Query error: '</span><span style="color: #007700">.</span><span style="color: #0000BB">$error_msg</span><span style="color: #007700">);</span>
</code></div><p>Utilizing the earlier call to retrieve the query error string. 
</p>
<p>
I have included a patch to the latest SVN revision, 1260: <a href="http://xtrafile.com/uploads/DB_driver.php.patch">http://xtrafile.com/uploads/DB_driver.php.patch</a>
<br />
-Matt
</p>
      ]]>
      </content>
    </entry>


</feed>