From: gggeek <giunta.gaetano@gmail.com>
Date: Sat, 30 May 2015 09:47:07 +0000 (+0200)
Subject: Fix: better generation of method signatures in wrap_php_ calls
X-Git-Tag: 4.0.0-alpha^2~27
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2e3b2ac38fb42c0b685a0c345f7f42ac823d7748;p=plcapi.git

Fix: better generation of method signatures in wrap_php_ calls
---

diff --git a/NEWS b/NEWS
index d941bcfd..8d8c130a 100644
--- a/NEWS
+++ b/NEWS
@@ -60,7 +60,8 @@ PLEASE READ CAREFULLY THE NOTES BELOW to insure a smooth upgrade.
 * fixed: the debugger would fail sending a request with ISO-8859-1 payload (it missed the character set declaration).
   It would have a hard time coping with ISO-8859-1 in other fields, such as e.g. the remote method name
 
-* fixed: the debugger would generate a bad payload via the 'load method synopsis' button for signatures containing NULLs
+* fixed: the debugger would generate a bad payload via the 'load method synopsis' button for signatures containing NULL
+  or undefined parameters
 
 * fixed: the debugger would generate a bad payload via the 'load method synopsis' button for methods with multiple
   signatures
diff --git a/src/Wrapper.php b/src/Wrapper.php
index 21321a64..f7f20721 100644
--- a/src/Wrapper.php
+++ b/src/Wrapper.php
@@ -280,10 +280,10 @@ class Wrapper
                     $desc .= $doc;
                 } elseif (strpos($doc, '@param') === 0) {
                     // syntax: @param type $name [desc]
-                    if (preg_match('/@param\s+(\S+)\s+(\$\S+)\s+(.+)?/', $doc, $matches)) {
+                    if (preg_match('/@param\s+(\S+)\s+(\$\S+)\s*(.+)?/', $doc, $matches)) {
                         $name = strtolower(trim($matches[2]));
                         //$paramDocs[$name]['name'] = trim($matches[2]);
-                        $paramDocs[$name]['doc'] = $matches[3];
+                        $paramDocs[$name]['doc'] = isset($matches[3]) ? $matches[3] : '';
                         $paramDocs[$name]['type'] = $matches[1];
                     }
                     $i++;