From 106f86c2107c23638bbcb078a74865e1051dd534 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 23 Jan 2013 19:39:49 +0100 Subject: [PATCH] Make Job::toString handle non-primitive parameters. Depending on PHP version, configuration and platform, Job::toString would cause warnings like this if non-primitive parameters where used in the job: Notice: Array to string conversion in C:\xampp\htdocs\wikidata-client\includes\job\Job.php on line 245 This change takes care of providing a sane representation of non-primitive values. Change-Id: I00ac52d40d39d8219626f5116172950f1b7af381 --- includes/job/Job.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/job/Job.php b/includes/job/Job.php index 927ca4e302..5f3cdf5c86 100644 --- a/includes/job/Job.php +++ b/includes/job/Job.php @@ -242,6 +242,13 @@ abstract class Job { if ( $paramString != '' ) { $paramString .= ' '; } + + if ( is_array( $value ) ) { + $value = "array(" . count( $value ) . ")"; + } else if ( is_object( $value ) && !method_exists( $value, '__toString' ) ) { + $value = "object(" . get_class( $value ) . ")"; + } + $paramString .= "$key=$value"; } } -- 2.20.1