?
avatar tranduyhung
tranduyhung
3 Oct 2014

Steps to reproduce the issue

  1. Install Joomla with PostgreSQL database type, select to install a sample data but don't select Test sample data, otherwise you get SQL errors (I have a pull request for it at https://github.com/joomla/joomla-cms/pull/4436/commits)

  2. Edit a sample article, save it.

Expected result

Article is saved successfully.

Actual result

Article isn't saved because of fatal error:

Notice: Undefined property: stdClass::$Field in /libraries/cms/helper/helper.php on line 114
Fatal error: Cannot access empty property in /libraries/cms/helper/helper.php on line 115

System information

  • PostgreSQL 9.3.5
  • Joomla! 3.3.6

Additional comments

The function getDataObject() of JHelper class tries to get the property "Field" which is only available in MySQL. In PostgreSQL we call it "column_name". This is a comparision of ID field:

PostgreSQL:

[id] => stdClass Object
    (
        [column_name] => id
        [type] => integer
        [null] => NO
        [Default] => nextval('pgj_content_id_seq'::regclass)
        [comments] => 
    )

MySQL:

[id] => stdClass Object
    (
        [Field] => id
        [Type] => int(10) unsigned
        [Collation] => 
        [Null] => NO
        [Key] => PRI
        [Default] => 
        [Extra] => auto_increment
        [Privileges] => select,insert,update,references
        [Comment] => 
    )

Instead of checking if the table is a JDatabaseDriverMysql object or a JDatabaseDriverPostgresql object in getDataObject() function to get the correct property, I think we can change the properties's names of PostgreSQL to be the same with the ones in MySQL.

Please see

That is how I've fixed this problem so far. But I don't know if this will break Joomla in other places, so your comments are suggestions are always appreciated. If it looks fine then I will send a pull request.

avatar tranduyhung tranduyhung - open - 3 Oct 2014
avatar vdespa vdespa - change - 3 Oct 2014
Category Postgresql
avatar tranduyhung
tranduyhung - comment - 3 Oct 2014

My bad, this issue was fixed already. I messed up my Joomla repository and kept using an old version. Sorry!

avatar zero-24 zero-24 - close - 3 Oct 2014
avatar zero-24 zero-24 - close - 3 Oct 2014
avatar tranduyhung tranduyhung - close - 3 Oct 2014
avatar tranduyhung tranduyhung - change - 3 Oct 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-10-03 17:39:32
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment