From: daniel Date: Wed, 23 Jan 2013 18:39:49 +0000 (+0100) Subject: Make Job::toString handle non-primitive parameters. X-Git-Tag: 1.31.0-rc.0~20945^2 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=106f86c2107c23638bbcb078a74865e1051dd534;p=lhc%2Fweb%2Fwiklou.git 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 --- 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"; } }