Skip to content

Commit

Permalink
MDL-49560 webservice: avoid recursion in soap
Browse files Browse the repository at this point in the history
Thanks to El Leonidych for providing a patch
  • Loading branch information
marinaglancy authored and danpoltawski committed May 26, 2015
1 parent 5c5fb8b commit 0676b9c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions webservice/soap/locallib.php
Expand Up @@ -273,11 +273,6 @@ protected function send_error($ex=null) {
*/
protected function generate_simple_struct_class(external_single_structure $structdesc) {
global $USER;
// let's use unique class name, there might be problem in unit tests
$classname = 'webservices_struct_class_000000';
while(class_exists($classname)) {
$classname++;
}

$fields = array();
foreach ($structdesc->keys as $name => $fieldsdesc) {
Expand All @@ -286,6 +281,12 @@ protected function generate_simple_struct_class(external_single_structure $struc
' public $'.$name.';';
}

// We do this after the call to get_phpdoc_type() to avoid duplicate class creation.
$classname = 'webservices_struct_class_000000';
while (class_exists($classname)) {
$classname++;
}

$code = '
/**
* Virtual struct class for web services for user id '.$USER->id.' in context '.$this->restricted_context->id.'.
Expand Down

0 comments on commit 0676b9c

Please sign in to comment.