Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error redirect #6333

Closed
maxdel85 opened this issue Mar 6, 2015 · 36 comments
Closed

Error redirect #6333

maxdel85 opened this issue Mar 6, 2015 · 36 comments

Comments

@maxdel85
Copy link

maxdel85 commented Mar 6, 2015

Hello everyone,
I would like to report a problem:
On all the sites where I Joomla, after upgrading to 3.4.0 if I go on a link insesistente, instead of the usual 404 error I get the following error:

jos-Warning: exception 'RuntimeException' with message 'Unknown column 'header' in 'field list' SQL=SELECT new_url,header,published FROM oq6_redirect_links WHERE old_url = 'http://URL INEXISTENT' LIMIT 0, 1' in /home/agenzias/public_html/libraries/joomla/database/driver/mysqli.php:610 Stack trace: #0 /home/agenzias/public_html/libraries/joomla/database/driver.php(1239): JDatabaseDriverMysqli->execute() #1 /home/agenzias/public_html/plugins/system/redirect/redirect.php(74): JDatabaseDriver->loadObject() #2 [internal function]: PlgSystemRedirect::handleError(Object(JException)) #3 /home/agenzias/public_html/libraries/legacy/error/error.php(760): call_user_func(Array, Object(JException)) #4 [internal function]: JError::handleCallback(Object(JException), Array) #5 /home/agenzias/public_html/libraries/legacy/error/error.php(218): call_user_func_array(Array, Array) #6 /home/agenzias/public_html/libraries/legacy/error/error.php(179): JError::throwError(Object(JException)) #7 /home/agenzias/public_html/libraries/legacy/error/error.php(254): JError::raise(1, 404, 'Articolo non tr...', NULL, true) #8 /home/agenzias/public_html/components/com_content/models/article.php(163): JError::raiseError(404, 'Articolo non tr...') #9 /home/agenzias/public_html/plugins/system/t3/includes/joomla30/viewlegacy.php(394): ContentModelArticle->getItem() #10 /home/agenzias/public_html/components/com_content/views/article/view.html.php(42): JViewLegacy->get('Item') #11 /home/agenzias/public_html/libraries/legacy/controller/legacy.php(690): ContentViewArticle->display() #12 /home/agenzias/public_html/components/com_content/controller.php(104): JControllerLegacy->display(true, Array) #13 /home/agenzias/public_html/libraries/legacy/controller/legacy.php(728): ContentController->display() #14 /home/agenzias/public_html/components/com_content/content.php(16): JControllerLegacy->execute(NULL) #15 /home/agenzias/public_html/libraries/cms/component/helper.php(380): require_once('/home/agenzias/...') #16 /home/agenzias/public_html/libraries/cms/component/helper.php(360): JComponentHelper::executeComponent('/home/agenzias/...') #17 /home/agenzias/public_html/libraries/cms/application/site.php(191): JComponentHelper::renderComponent('com_content') #18 /home/agenzias/public_html/libraries/cms/application/site.php(230): JApplicationSite->dispatch() #19 /home/agenzias/public_html/libraries/cms/application/cms.php(251): JApplicationSite->doExecute() #20 /home/agenzias/public_html/index.php(40): JApplicationCms->execute() #21 {main}

Disabling the plugin redirects the situation returns to normal, and the system returns the classic 404.
Having several articles that update automatically and have a deadline I was very comfortable the automatic redirect ... someone who has had the same problem as me knows say has solved?
Thank You

@mokhin-denis
Copy link

After 3.4 upgrade (I think) there is an HTTP 500 error on my website, when I go thru redirected links. After disabling redirect plugin, wrong links are processing as HTTP 404 normaly


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6333.

@mbabker
Copy link
Contributor

mbabker commented Mar 6, 2015

It appears your database is not up-to-date with the current system schema. If you go to the Extension Manager's Database view, you can check this and attempt to fix it by clicking the "Fix" button in the toolbar.

@maxdel85
Copy link
Author

maxdel85 commented Mar 6, 2015

Hello mbabker,
I tried following the steps, but nothing has changed:-(

@mokhin-denis
Copy link

My DB is up-to-date too

@tarotray
Copy link

This seems to be a definite Joomla! bug of some sort.

A client has just reported a similar error (J! 3.4):

N.B. the domain name has been replaced by ''.

jos-Warning: exception 'RuntimeException' with message 'Unknown column 'header' in 'field list' SQL=SELECT new_url,header,published FROM acw_redirect_links WHERE old_url = 'http://www..nl/acupunctuur/japanse/kiiko-matsumoto.html' LIMIT 0, 1' in /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/joomla/database/driver/mysqli.php:610 Stack trace: #0 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/joomla/database/driver.php(1239): JDatabaseDriverMysqli->execute() #1 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/plugins/system/redirect/redirect.php(74): JDatabaseDriver->loadObject() #2 [internal function]: PlgSystemRedirect::handleError(Object(JException)) #3 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/legacy/error/error.php(760): call_user_func(Array, Object(JException)) #4 [internal function]: JError::handleCallback(Object(JException), Array) #5 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/legacy/error/error.php(218): call_user_func_array(Array, Array) #6 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/legacy/error/error.php(179): JError::throwError(Object(JException)) #7 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/legacy/error/error.php(254): JError::raise(1, 404, 'Article not fou...', NULL, true) #8 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/components/com_content/models/article.php(163): JError::raiseError(404, 'Article not fou...') #9 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/legacy/view/legacy.php(401): ContentModelArticle->getItem() #10 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/components/com_content/views/article/view.html.php(42): JViewLegacy->get('Item') #11 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/joomla/cache/controller/view.php(96): ContentViewArticle->display() #12 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/legacy/controller/legacy.php(686): JCacheControllerView->get(Object(ContentViewArticle), 'display') #13 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/components/com_content/controller.php(104): JControllerLegacy->display(true, Array) #14 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/legacy/controller/legacy.php(728): ContentController->display() #15 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/components/com_content/content.php(16): JControllerLegacy->execute(NULL) #16 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/cms/component/helper.php(380): require_once('/var/www/vhosts...') #17 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/cms/component/helper.php(360): JComponentHelper::executeComponent('/var/www/vhosts...') #18 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/cms/application/site.php(191): JComponentHelper::renderComponent('com_content') #19 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/cms/application/site.php(230): JApplicationSite->dispatch() #20 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/libraries/cms/application/cms.php(251): JApplicationSite->doExecute() #21 /var/www/vhosts/17/107157/webspace/httpdocs/.nl/index.php(40): JApplicationCms->execute() #22 {main}

On checking, I find the database IS up to date:

Database table structure is up to date.

Other Information

Database schema version (in #__schemas): 3.4.0-2015-01-21.
Update version (in #__extensions): 3.4.0.
Database driver: mysqli.
79 database changes were checked successfully.
141 database changes did not alter table structure and were skipped.

@infograf768
Copy link
Member

Your database has not been updated correctly.
You should run in phpmyadmin ( after replacing #__ by myprefix_ where myprefix is your database prefix)

ALTER TABLE `#__redirect_links` ADD header smallint(3) NOT NULL DEFAULT 301;
ALTER TABLE `#__redirect_links` MODIFY new_url varchar(255);

@messinmaisoui
Copy link

Hello,
Same trouble for me ... I did
ALTER TABLE #__redirect_links ADD header smallint(3) NOT NULL DEFAULT 301;
ALTER TABLE #__redirect_links MODIFY new_url varchar(255);
=>
All rows affected by command "add header"
(and nothing for new_url) already varchar(255)

But on my website, change language still not working !
Finally I find this link (French) and all is fine now
=> https://docs.joomla.org/J3.x:Infinite_error_loop_on_multilanguage_sites/fr
Hope it will help !

Laurent

@Hackwar
Copy link
Member

Hackwar commented Mar 16, 2015

Can this be closed?

@webcodes1
Copy link

Don't close it yet, this issue is going to keep popping up as it has with me today. Not knowing too much about phpmyadmin, but just enough to get me into trouble, how does one go about safely applying this fix? ie, talk us through where to go in phpmyadmin and where to put it please.

Thanks

Bruce


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6333.

@810
Copy link
Contributor

810 commented Mar 29, 2015

when you google the error, you find many sites with the issue
https://www.google.nl/#q=Fatal+error:+Uncaught+exception+%27RuntimeException%27+with+message+%27Unknown+column+%27header%27+in+%27field+list%27+SQL%3DSELECT+%60new_url%60%2C%60

After:

ALTER TABLE `#__redirect_links` ADD header smallint(3) NOT NULL DEFAULT 301;
ALTER TABLE `#__redirect_links` MODIFY new_url varchar(255);

Still getting the error:

Fatal error: Uncaught exception 'RuntimeException' with message 'Unknown column 'header' in 'field list' SQL=SELECT new_url,header,published FROM dc60p_redirect_links WHERE old_url = 'https://www.mysite.com/log-out&tmpl=component' LIMIT 0, 1' in /home/public_html/libraries/joomla/database/driver/mysqli.php:610 Stack trace: #0 /home/public_html/libraries/joomla/database/driver.php(1239): JDatabaseDriverMysqli->execute() #1 /home/public_html/plugins/system/redirect/redirect.php(86): JDatabaseDriver->loadObject()
#2 [internal function]: PlgSystemRedirect::handleError(Object(RuntimeException))
#3 {main} thrown in /home/public_html/libraries/joomla/database/driver/mysqli.php on line 610

Fix:
add header after new_url

@BloodyBakala
Copy link

after upgrading to joomla 3.4.1 when I try to add new external urls for custom buttons, it gives me a fattal error, because it tries to go to my url/externalurl


Fatal error: Uncaught exception 'RuntimeException' with message 'Unknown column 'header' in 'field list' SQL=SELECT new_url,header,published FROM _redirect_linksWHEREold_url` = '/www.amazon.com' LIMIT 0, 1' in /libraries/joomla/database/[drive]/mysqli.php:610 Stack trace: #0 /libraries/joomla/database/[drive].php(1239): [drive]>execute() #1 /plugins/system/redirect/redirect.php(86): [drive]>loadObject() #2 [internal function]: PlgSystemRedirect::handleError(Object(RuntimeException)) #3 {main} thrown in libraries/joomla/database/[drive]/mysqli.php on line 610


any solution? thanks


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6333.

@mbabker
Copy link
Contributor

mbabker commented Apr 8, 2015

this is a joomla error

Can you back this claim? The only way this specific error can occur is if the database did not get properly updated. Presumably, if the queries from this file did not get applied, then any new queries shouldn't have been executed or applied either. Update logs would show what queries were actually executed and possibly any failures. If it's really a wide spread issue, there would be a common trend to how sites were updated; using the update component, installing through the extension manager, manually FTP'ing files, or a third party platform.

@BloodyBakala
Copy link

hello back,

seems that error is well spread on joomla 3.4.1. You can even trace hundreds of recent listed websites on google with the same direct error, listed even on google while looking for :

Fatal error: Uncaught exception 'RuntimeException' with message 'Unknown column 'header' in 'field list' SQL=SELECT new_url,header,published FROM

I just tried to look at my rss:

www.myurl.com//itemlist?format=feed&type=rss

and get this massive white crash error.

The update from joomla 3.4.0 to jooomla 3.4.1 was from the update Joomla_3.4.x_to_3.4.1-Stable-Patch_Package from the official joomla website.

I will try to patch tomorrow with the full package to see what happens.

Any idea? Cheers

@zero-24
Copy link
Contributor

zero-24 commented Apr 9, 2015

@BloodyBakala

Any idea? Cheers

Try to fix your databse. (Extension -> Extension Manager -> Database -> Fix)

SQL is here: https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql

@BloodyBakala
Copy link

hello,

The database was fixed but still same error. What do you want me to do with that sql? where to include it?

Do you randomly want me to put this code somwhere in the sql?

ALTER TABLE #__redirect_links ADD header smallint(3) NOT NULL DEFAULT 301;
ALTER TABLE #__redirect_links MODIFY new_url varchar(255);

Thanks


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6333.

@810
Copy link
Contributor

810 commented Apr 18, 2015

sorry @mbabker , i have edit the message

This is the working sql fix

ALTER TABLE `#__redirect_links` ADD header smallint(3) NOT NULL DEFAULT 301 AFTER `new_url`;
ALTER TABLE `#__redirect_links` MODIFY new_url varchar(255);

First look if header is missing on the table, if there is header in the row, then delete it.
and apply above

maybe you get a error, that's ok, then the last alter table is already varchar(255).

Look again in the table if header is there.

@BeatrizVH
Copy link

Thanks for the information, it works great.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6333.

@acidicX
Copy link

acidicX commented Jun 26, 2015

The fix is not working for me. My DB was up to date; I still applied the fix. Now I get a HTTP 404.,

Seems to be an issue with multi language as well, the link from my page goes to a PDF (download) and still gets the language appended ( /en/ after the domain in my case). This leads to a 404.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6333.

@acidicX
Copy link

acidicX commented Jun 26, 2015

Scratch that, the fix works - my link was not case sensitive. The db error was fixed after applying the SQL statement. Still, this should have been done automatically on upgrade...


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6333.

@zero-24
Copy link
Contributor

zero-24 commented Jun 26, 2015

@acidicX

Still, this should have been done automatically on upgrade...

It will be done automatically 😄

See: https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql

@smz
Copy link
Contributor

smz commented Jun 27, 2015

Can we close this?

@zero-24 zero-24 closed this as completed Jun 27, 2015
@acidicX
Copy link

acidicX commented Jun 27, 2015

@zero-24 juding from the date of the patch, this should have been included in 3.4.1?
My Joomla! was updated to 3.4.1. a while ago, the DB upgrade assistant displayed that the DB scheme was up to date, but I still had to apply the fix manually. This leaves two possible conclusions:

  1. The patch is somehow not included in 3.4.1
  2. The DB upgrade path is broken

@felorhik
Copy link

This is still an issue in 3.4.6 and using the database fix tool in the extension manager does not see, nor fix the issue.

Manually running the query posted above does fix it, however it seems that this cannot be fixed through the CMS.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6333.

@wojsmol
Copy link
Contributor

wojsmol commented Dec 25, 2015

@mbabker @infograf768 @zero-24 see #8786 I found the probable cause of the problems with this file

wojsmol added a commit to wojsmol/joomla-cms that referenced this issue Dec 26, 2015
PR fot issue  joomla#8786
Original issue description
>IMHO file https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql contains MySQL syntax errors :
>is
>````SQL
>ALTER TABLE `#__redirect_links` ADD header smallint(3) NOT NULL DEFAULT 301;
>ALTER TABLE `#__redirect_links` MODIFY new_url varchar(255);
>````
>should be
>````sql
>ALTER TABLE `#__redirect_links` ADD `header` smallint(3) NOT NULL DEFAULT 301;
>ALTER TABLE `#__redirect_links` MODIFY `new_url` varchar(255);
>````
>related: joomla#6333
@ggppdk
Copy link
Contributor

ggppdk commented Dec 26, 2015

Ok, i think i found the reason:

class JSchemaChangeitemMysql, function buildCheckQuery()

  • the case of: "ADD columnname" or "ADD columnname" are not detected
  • only this is accepted: "ADD COLUMN columnname"
$file = ".../administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql";
$buffer = file_get_contents($file);
$queries = JDatabaseDriver::splitSql($buffer);
foreach($queries as $query) {
    $test = new JSchemaChangeitemMysql(JFactory::getDBO(), $file, $query);
    echo "<pre>";
    print_r($test);
    echo "</pre>";
}
exit;

you can see that the checkQuery property is not created properly
if you modify file the class JSchemaChangeitemMysql at file, to add:

echo $alterCommand;

.../libraries/cms/schema/changeitem/mysql.sql

if ($command === 'ALTER TABLE')
{
    $alterCommand = strtoupper($wordArray[3] . ' ' . $wordArray[4]);
    echo $alterCommand;
    ....
}

you will get:
"ADD HEADER" but correct detection should give: "ADD COLUMN"

a fix could , that i tested and seems to work properly is to add a elseif at the bottom of if-else chain:

elseif (strtoupper($wordArray[3]) == 'ADD' && strtoupper($wordArray[4]) != 'KEY')
{
    $result = 'SHOW COLUMNS IN ' . $wordArray[2] . ' WHERE field = ' . $this->fixQuote($wordArray[4]);
    $this->queryType = 'ADD_COLUMN';
    $this->msgElements = array($this->fixQuote($wordArray[2]), $this->fixQuote($wordArray[4]));
}

@ggppdk
Copy link
Contributor

ggppdk commented Dec 26, 2015

Please re-open this, see my answer above

  • either JSchemaChangeitemMysql needs to be fixed
  • or check that ALL update SQL files use "ADD COLUMN columnname" instead of "ADD columnname"

@wojsmol
Copy link
Contributor

wojsmol commented Dec 26, 2015

@ggppdk IMHO fix in JSchemaChangeitemMysql is a better approach.

@infograf768
Copy link
Member

Set to "open" on behalf of @infograf768 by The JTracker Application at issues.joomla.org/joomla-cms/6333

@infograf768
Copy link
Member

re-opened

@ggppdk
Copy link
Contributor

ggppdk commented Dec 26, 2015

@infograf768, thanks, next week, I will have more time,
will test this more and make a pull request

@N6REJ
Copy link
Contributor

N6REJ commented Dec 26, 2015

why are there 3 dots in front of the path?
Bear

On 12/25/2015 23:19, Georgios Papadakis wrote:

Ok, i think i found the reason:

class JSchemaChangeitemMysql, function buildCheckQuery()

  • the case of: "ADD columnname" or "ADD |columnname|" are not detected
  • only this is accepted: "ADD COLUMN columnname"

|$file =
".../administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql";
$buffer = file_get_contents($file); $queries =
JDatabaseDriver::splitSql($buffer); foreach($queries as $query) {
$test = new JSchemaChangeitemMysql(JFactory::getDBO(), $file, $query);
echo "

"; print_r($test); echo "
"; } exit; |

you can see that the checkQuery property is not created properly
if you modify file the class JSchemaChangeitemMysql at file, to add:

|echo $alterCommand; |

.../libraries/cms/schema/changeitem/mysql.sql

|if ($command === 'ALTER TABLE') { $alterCommand =
strtoupper($wordArray[3] . ' ' . $wordArray[4]); echo $alterCommand;
.... } |

you will get:
"ADD HEADER" but correct detection should give: "ADD COLUMN"

a fix could , that i tested and seems to work properly is to add a
elseif at the bottom of if-else chain:

|elseif (strtoupper($wordArray[3]) == 'ADD') { $result = 'SHOW COLUMNS
IN ' . $wordArray[2] . ' WHERE field = ' .
$this->fixQuote($wordArray[4]); $this->queryType = 'ADD_COLUMN';
$this->msgElements = array($this->fixQuote($wordArray[2]),
$this->fixQuote($wordArray[4])); } |


Reply to this email directly or view it on GitHub
#6333 (comment).

@ggppdk
Copy link
Contributor

ggppdk commented Dec 26, 2015

@N6REJ
i just edited the path ... for the purpose of posting it here

My local path is:
D:/xampp/htdocs/j34x/administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql

  • the file was read and the above code was run
    thus i found the bug at class JSchemaChangeitemMysql
  • if the above bug is the reason for the ADD COLUMN query not running to update redirect_links when joomla is upgraded, i do not know yet, i will confirm it when i test setup an older Joomla and i test upgrading

@ggppdk
Copy link
Contributor

ggppdk commented Dec 26, 2015

Ok, i confirm at least the DATABASE "Fix" button now works

after using in the JSchemaChangeitemMysql:

elseif (strtoupper($wordArray[3]) == 'ADD' && strtoupper($wordArray[4]) != 'KEY')
{
    $result = 'SHOW COLUMNS IN ' . $wordArray[2] . ' WHERE field = ' . $this->fixQuote($wordArray[4]);
    $this->queryType = 'ADD_COLUMN';
    $this->msgElements = array($this->fixQuote($wordArray[2]), $this->fixQuote($wordArray[4]));
}

I manually deleted the header column from the redirect_links

  • the database view of Joomla extension manager now reports that the column
    missing_column_detected
    fix_button_worked

Notice that without the fix the reported DB changes are 79, and with the fix the reported changes are 80
without_fix

If the Joomla upgrade process uses the same check then that is the reason why the change is not applied. I have not tested upgrade yet

@ggppdk
Copy link
Contributor

ggppdk commented Dec 27, 2015

This issue regarding redirect_links table, can be re-closed since

But if found 1 more non-handled case with

JSchemaChangeitemMysql 
  • it does not handled / does not detect "ADD KEY" (synonym for "ADD INDEX" which is handled)

Found 1 case of usage of it in file: 2.5.4-2012-03-19.sql

ALTER TABLE `#__languages` ADD KEY `idx_access` (`access`);

After patching JSchemaChangeitemMysql or patching the SQL file, the number of database changes reported go up to 81,
nobody reported the above because a missing index after upgrading Joomla will not cause any errors

I will make a pull request for both cases:
"ADD KEY"
"ADD colname"

@brianteeman
Copy link
Contributor

I am closing this as it was resolved with #8788


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6333.

@rotech1
Copy link

rotech1 commented Oct 7, 2016

for sake of anyone who stumbles on this looking for solution to jos-error, i found that I only get the jos-error if an alias starts with a NUMBER


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/6333.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests