Menu

#2976 Uncatched PDO exception trying edit gedcom privacy file

v4.3.1
closed-fixed
None
5
2022-09-14
2022-09-14
No

Garry, sorry that I don't send a solution but the error report, but I have no idea what's going on.
I have two servers with the same configuration and the same genealogical data. The difference is that at the first server PHP is in the 8th version and MariaDB plays as the database. At this server all works OK.

The second server has PHP in 7.4 version and postgresql 13 as the DB. Here, when I try to edit privacy file I get the error (xxx and ... are for anonymize data):

( ! ) Fatal error: Uncaught PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type smallint: "xxx.ged" in .../includes/classes/class_pgv_db.php on line 852
( ! ) PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type smallint: "xxx.ged" in .../includes/classes/class_pgv_db.php on line 852
Call Stack

Time Memory Function Location

1 0.0001 378536 {main}( ) .../edit_privacy.php:0
2 0.0322 886992 userGedcomAdmin( $user_id = 1, $ged_id = 'xxx.ged' ) .../edit_privacy.php:36
3 0.0322 886992 get_user_gedcom_setting( $user_id = 1, $ged_id = 'xxx.ged', $setting_name = 'canedit' ) .../authentication.php:169
4 0.0322 889344 PGV_DBStatement->execute( [0 => 1, 1 => 'xxx.ged', 2 => 'canedit'] ) .../functions_db.php:2731
5 0.0322 889720 PGV_DBStatement->__call( $function = 'execute', $params = [0 => [0 => 1, 1 => 'xxx.ged', 2 => 'canedit']] ) .../functions_db.php:2731
6 0.0322 889720 execute( $bound_input_params = [0 => 1, 1 => 'xxx.ged', 2 => 'canedit'] ) .../class_pgv_db.php:852

The statement executed is: "SELECT gedcom_id FROM pgv_gedcom WHERE gedcom_name=?". When I execute it at the target DB, it works fine returning the proper ID. I don't understand what's going wrong. I can't debug php on this server now (I had a malware attack and the services are mostly blocked).

T.B.

Discussion

  • Tomasz Babczyński

    Sorry, mistake, not this select. It happens after it. The function "get_user_gedcom_setting" gets as gedcom_id the name of it instead of the id. Why? PGV_GED_ID wrong?

     
  • Gerry Kroll

    Gerry Kroll - 2022-09-14

    It looks as if the pgv_user_gedcom_setting database table on the second server (the postgresql version) is not populated correctly. I can't begin to speculate how this happened. It's most unlikely that the fault is in PhpGedView.

    I suggest that you use phpMyAdmin to inspect the pgv_gedcom and pgv_user_gedcom_setting tables on the "not working" server. The contents of the gedcom_id columns should be integers.

     
  • Tomasz Babczyński

    Hi,
    I've found that the 36 line of edit_privacy.php file puts $ged instead of $ged_id, probably causing the problem. It is strange for me that mysql ignores it but postgresql always was more orthodox.
    The mysql emits:
    Warning: #1292 Truncated incorrect DOUBLE value
    and returns empty result, causing the portal defaults to be used.

    I've corrected this and it just works at both servers :)
    I'm not sure whether ged_id is always valid at this place. Maybe get_id_from_gedcom should be called before.

    T.B.

     
    • Tomasz Babczyński

      Look also, please at 74th line of printlog.php. Couldn't it be get_id_from_gedcom called instead of get_gedcom_from_id?
      The rest of userGedcomAdmin calls looks correct.

      T.

       
  • Gerry Kroll

    Gerry Kroll - 2022-09-14

    Tomasz:
    You are absolutely correct.

    Please try the attached, and let me know whether this fixes both of your problems.

     
    • Tomasz Babczyński

      Gerry,
      it works like charm.

       
  • Gerry Kroll

    Gerry Kroll - 2022-09-14
    • status: open --> closed-fixed
    • assigned_to: Gerry Kroll
     
  • Gerry Kroll

    Gerry Kroll - 2022-09-14

    Fixed in SVN 7353

     

Log in to post a comment.