propertyhive / WP-Property-Hive

The complete estate agency software plugin for WordPress
Other
27 stars 27 forks source link

Error around esc_textarea( $field['value'] ) with data imported from DezRez Json #73

Open markheydon opened 6 years ago

markheydon commented 6 years ago

$field['value'] seems to be coming through as array not string in some cases, thus crashes when trying to edit the property. Data imported via the Property Hive Import add-on from DezRez JSON.


Warning: htmlspecialchars() expects parameter 1 to be string, array given in .../public_html/wp-includes/formatting.php on line 4002
--

1 | 0.0720 | 402848 | {main}( ) | .../post.php:0
2 | 12.3466 | 15583776 | include( '.../public_html/wp-admin/edit-form-advanced.php' ) | .../post.php:174
3 | 14.1165 | 15853080 | do_meta_boxes( null, string(6), object(WP_Post)[7106] ) | .../edit-form-advanced.php:714
4 | 14.7429 | 16161624 | PH_Meta_Box_Property_Rooms::output( object(WP_Post)[7106], array(4) ) | .../template.php:1073
5 | 14.7445 | 16162024 | propertyhive_wp_textarea_input( array(9) ) | .../class-ph-meta-box-property-rooms.php:70
6 | 14.7446 | 16162768 | esc_textarea( array(82) ) | .../ph-meta-box-functions.php:228
7 | 14.7447 | 16162768 | htmlspecialchars ( array(82), long, string(5) ) | .../formatting.php:4002
propertyhive commented 5 years ago

@markheydon Would it be possible to get a hold of the Dezrez details being used and an example property where this is occurring? Feel free to send them through to info@wp-property-hive.com so they're kept private, and I'll take a look and revert my findings back here. Tried a few sets of details I have here to hand but can't recreate.

Thanks

markheydon commented 5 years ago

Hi @propertyhive ,

I have copied the 'Rooms' bit from the DezRez response below. Looking it at, the difference appears to be the ones where the warning is being thrown in the UI has 'null' for 'Text' whereas the others are an empty string. I have also emailed the full JSON response and screenshot showing a property that has the issue.

Mark

            "Rooms": [
                {
                    "Order": 1,
                    "Name": "GROUND FLOOR",
                    "Text": null,
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Floor",
                        "SystemName": "Floor"
                    }
                },
                {
                    "Order": 2,
                    "Name": "Entrance Hall",
                    "Text": "",
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Room",
                        "SystemName": "Room"
                    }
                },
                {
                    "Order": 3,
                    "Name": "FIRST FLOOR",
                    "Text": null,
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Floor",
                        "SystemName": "Floor"
                    }
                },
                {
                    "Order": 4,
                    "Name": "Lounge",
                    "Text": "",
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Room",
                        "SystemName": "Room"
                    }
                },
                {
                    "Order": 5,
                    "Name": "Kitchen",
                    "Text": "",
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Room",
                        "SystemName": "Room"
                    }
                },
                {
                    "Order": 6,
                    "Name": "Bedroom One",
                    "Text": "",
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Room",
                        "SystemName": "Room"
                    }
                },
                {
                    "Order": 7,
                    "Name": "Bedroom Two",
                    "Text": "",
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Room",
                        "SystemName": "Room"
                    }
                },
                {
                    "Order": 8,
                    "Name": "Bathroom",
                    "Text": "",
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Room",
                        "SystemName": "Room"
                    }
                },
                {
                    "Order": 9,
                    "Name": "OUTSIDE",
                    "Text": null,
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Floor",
                        "SystemName": "Floor"
                    }
                },
                {
                    "Order": 10,
                    "Name": "Garage",
                    "Text": "",
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Room",
                        "SystemName": "Room"
                    }
                },
                {
                    "Order": 11,
                    "Name": "Garden",
                    "Text": "",
                    "Images": [],
                    "RoomDescriptionType": {
                        "DisplayName": "Room",
                        "SystemName": "Room"
                    }
                }
            ],
            "DescriptionType": {
                "DisplayName": "Room",
                "SystemName": "Room"
            },
            "Name": "Room",
            "Notes": null