Topic: tiny error in xajax.php

Thereis probably a tiny error in xajax.php.

The function private function _detectURI() contains the error.

Line 924 : $aURL = parse_url($_SERVER['REQUEST_URI']);
is correct.

But line 981 and further are not correct:
if (empty($aURL['query']) && !empty($_SERVER['QUERY_STRING'])) {
    $aURL['query'] = $_SERVER['QUERY_STRING']; }

if (!empty($aURL['query'])) {
    $aURL['query'] = '?'.$aURL['query'];
}

If empty($aURL['query']) is true
    and !empty($_SERVER['QUERY_STRING']) is not true then
    $aURL['query'] will not be set !!

Line 1010 $sURL.= $aURL['path'].@$aURL['query']; will generate an error.


With Regards,

Ed van Doorn

Re: tiny error in xajax.php

Thanks, Ed. Will look into it...

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: tiny error in xajax.php

I have looked through the code you referenced in xajax.inc.php and can find no problem.

In fact the xajax class constructor calls this function if you do not include a url in the call to create the object.

I never do include a url - just $xajax = new xajax(); and I have never seen an error do to the detectURL method.


Can you be a little more specific? Have you seen the error?

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: tiny error in xajax.php

The logfile of Codeigniter (a PHP framework) reports :

ERROR - 2014-11-11 19:21:05 --> Severity: Notice  --> Undefined index: query /var/Codeigniter/application/libraries/xajax_core/xajax.php 1010

During executing of the code no problem was noticed by the user, but it was reported in the log-file.

I solved the problem
The lines starting at 985 in xajax.php:
if (!empty($aURL['query'])) {
                        $aURL['query'] = '?'.$aURL['query'];
                }

I added two lines:

if (!empty($aURL['query'])) {
                        $aURL['query'] = '?'.$aURL['query'];
                }
else
                    $aURL['query'] = "";

So $aURL['query']  is set and
line 1010 : $sURL.= $aURL['path'].@$aURL['query'];
won't cause an error.

By the way it is nice framework which easily can be used.
Thanks!

With regards.

Ed van Doorn

Re: tiny error in xajax.php

I have used CI and really like it. I will look at the problem in CI...

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.