mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-49560 webservice: avoid recursion in soap
Thanks to El Leonidych for providing a patch
This commit is contained in:
parent
803f565753
commit
d08f2f1175
1 changed files with 6 additions and 5 deletions
|
@ -273,11 +273,6 @@ class webservice_soap_server extends webservice_zend_server {
|
|||
*/
|
||||
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) {
|
||||
|
@ -286,6 +281,12 @@ class webservice_soap_server extends webservice_zend_server {
|
|||
' 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.'.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue