Index: branches/5.2.x/core/kernel/globals.php
===================================================================
diff -u -N -r16513 -r16535
--- branches/5.2.x/core/kernel/globals.php (.../globals.php) (revision 16513)
+++ branches/5.2.x/core/kernel/globals.php (.../globals.php) (revision 16535)
@@ -1,6 +1,6 @@
isDebugMode() ) {
+ return;
+ }
+
+ $msg = '%1$s is deprecated since version %2$s';
+
+ if ( !is_null($replacement) ) {
+ @trigger_error(sprintf($msg . '! Use %3$s instead.', $method, $version, $replacement), E_USER_DEPRECATED);
+ }
+ else {
+ @trigger_error(sprintf($msg . ' with no alternative available.', $method, $version), E_USER_DEPRECATED);
+ }
+ }
+
+ /**
+ * Mark a method argument as deprecated and inform when it has been used.
+ *
+ * This method is to be used whenever a deprecated method argument is used.
+ * Before this method is called, the argument must be checked for whether it was
+ * used by comparing it to its default value or evaluating whether it is empty.
+ * For example:
+ *
+ * if ( !$deprecated ) {
+ * kUtil::deprecatedArgument(__METHOD__, '5.2.2');
+ * }
+ *
+ * The current behavior is to trigger a user deprecation notice in Debug Mode.
+ *
+ * @param string $method The method that was called.
+ * @param string $version The version that deprecated the argument used.
+ * @param string|null $message A message regarding the change.
+ *
+ * @return void
+ */
+ public static function deprecatedArgument($method, $version, $message = null)
+ {
+ $application =& kApplication::Instance();
+
+ if ( !$application->isDebugMode() ) {
+ return;
+ }
+
+ $msg = '%1$s was called with an argument that is deprecated since version %2$s';
+
+ if ( !is_null($message) ) {
+ @trigger_error(sprintf($msg . '! %3$s', $method, $version, $message), E_USER_DEPRECATED);
+ }
+ else {
+ @trigger_error(sprintf($msg . ' with no alternative available.', $method, $version), E_USER_DEPRECATED);
+ }
+ }
+
}
/**