Title: Critical Error metadata-sensor type string, int given
Last modified: May 22, 2023

---

# Critical Error metadata-sensor type string, int given

 *  Resolved [deejay212005](https://wordpress.org/support/users/deejay212005/)
 * (@deejay212005)
 * [3 years ago](https://wordpress.org/support/topic/critical-error-metadata-sensor-type-string-int-given/)
 * I have an LMS that uses integers as meta_keys. 
   This throws a critical error 
   when wp-security-audit-log attempts string functions.
 * I would like to suggest the following changes for a future update to resolve 
   this:
 * wp-security-audit-log/classes/WPSensors/class-wp-metadata-sensor.php:597
   if (‘_’
   === substr( (string)$meta_key, 0, 1 ) ) {
 * wp-security-audit-log/classes/WPSensors/class-wp-metadata-sensor.php:568
   if (
   false !== strpos( (string)$meta_key, ‘shipping_’ ) || false !== strpos( (string)
   $meta_key, ‘billing_’ ) ) {
 * wp-activity-log-for-woocommerce/wp-security-audit-log/sensors/class-woocommerce-
   public-sensor.php:123
   $address_key = str_replace( array( ‘shipping_’, ‘billing_’),”,(
   string)$meta_key );
 * wp-activity-log-for-woocommerce/wp-security-audit-log/sensors/class-woocommerce-
   sensor.php:5553
   $address_key = str_replace( array( ‘shipping_’, ‘billing_’ ),”,(
   string)$meta_key );

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [3 years ago](https://wordpress.org/support/topic/critical-error-metadata-sensor-type-string-int-given/#post-16766771)
 * Thank you using our plugin and for your feedback [@deejay212005](https://wordpress.org/support/users/deejay212005/)
 * We’d like to better understand what the issue is so we can ensure a solid fix.
   To do this, can you explain to us, or point us to some documents that explains
   a bit better what is “LMS that uses integers as meta_keys.”?
 * We have never heard of it so we’d like to learn more about it.
 *  Thread Starter [deejay212005](https://wordpress.org/support/users/deejay212005/)
 * (@deejay212005)
 * [3 years ago](https://wordpress.org/support/topic/critical-error-metadata-sensor-type-string-int-given/#post-16767134)
 * Hello [@robert681](https://wordpress.org/support/users/robert681/)
 * The LMS (learning management system) we use is WPLMS.
 * As an example a Quiz (post_id) stores a user ID (meta_key) and the user’s score(
   meta_value).
 * this causes the following error:
   An error of type E_ERROR was caused in line 
   597 of the file /wp-content/plugins/wp-security-audit-log/classes/WPSensors/class-
   wp-metadata-sensor.php. Error message: Uncaught TypeError: substr(): Argument#
   1 ($string) must be of type string, int given in wp-content/plugins/wp-security-
   audit-log/classes/WPSensors/class-wp-metadata-sensor.php:597
 *  Plugin Support [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [3 years ago](https://wordpress.org/support/topic/critical-error-metadata-sensor-type-string-int-given/#post-16776061)
 * Thank you for the details. I’ve escalated this and we’ll include a fix in the
   next update of the plugin. We’ll let you know if we need more information.
 * In the meantime, if you have any other questions, please do not hesitate to ask.
 * Have a good day.
 *  Plugin Support [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/critical-error-metadata-sensor-type-string-int-given/#post-17130057)
 * Hello [@deejay212005](https://wordpress.org/support/users/deejay212005/)
 * Today we have just released update 4.6.0 which includes this fix. You can read
   the [WP Activity Log release notes](https://melapress.com/wordpress-activity-log/releases/)
   for more details about what is new and improved in this update.
 * Please install the latest version of the plugin to fix the issue.
 * Thank you for using our plugin.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Critical Error metadata-sensor type string, int given’ is closed to new
replies.

 * ![](https://ps.w.org/wp-security-audit-log/assets/icon-256x256.png?rev=2961534)
 * [WP Activity Log](https://wordpress.org/plugins/wp-security-audit-log/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-security-audit-log/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-security-audit-log/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-security-audit-log/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-security-audit-log/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-security-audit-log/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [robertabela](https://wordpress.org/support/users/robert681/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/critical-error-metadata-sensor-type-string-int-given/#post-17130057)
 * Status: resolved