phpactiveresource icon indicating copy to clipboard operation
phpactiveresource copied to clipboard

https://github.com/jbroadway/phpactiveresource/tree/master id issue still exists in line 244

Open arpad-osvald opened this issue 1 year ago • 0 comments

Hi,

id issue not fixed thoroughly - it still exists in line 244

osv@blackbook001:~/Work/Redmine/tests$ phpactiveresource-master/examples/redmine.php
**PHP Notice:  Undefined index: id in /home/osv/Work/Redmine/tests/phpactiveresource-master/lib/ActiveResource/ActiveResource.php on line 244**
RmIssue Object
(
    [site] => http://redmine.work.bory/
    [element_name] => issue
    [request_headers] => Array
        (
            [0] => x-api-key: 5ccb0f6e300893352b70d378d9c4845b80f09b0e
        )

    [extra_params] => 
    [user] => 
    [password] => 
    [element_name_plural] => issues
    [_data:ActiveResource\ActiveResource:private] => Array
        (
        )

    [error] => HTTP Basic: Access denied.
    [errno] => 401
    [request_body] => 
    [request_uri] => http://redmine.work.bory/issues.xml?assigned_to=Redmine+Admin
    [request_method] => GET
    [response_code] => 
    [response_headers] => 
    [response_body] => 
    [request_format] => url
    [pleural_corrections] => Array
        (
            [persons] => people
            [peoples] => people
            [mans] => men
            [mens] => men
            [womans] => women
            [womens] => women
            [childs] => children
            [childrens] => children
            [sheeps] => sheep
            [octopuses] => octopi
            [quizs] => quizzes
            [axises] => axes
            [buffalos] => buffaloes
            [tomatos] => tomatoes
            [potatos] => potatoes
            [oxes] => oxen
            [mouses] => mice
            [matrixes] => matrices
            [vertexes] => vertices
            [indexes] => indices
        )

)
osv@blackbook001:~/Work/Redmine/tests$ 
osv@blackbook001:~/Work/Redmine/tests$ vi  /home/osv/Work/Redmine/tests/phpactiveresource-master/lib/ActiveResource/ActiveResource.php

235 
236         /**
237          * Finds a record or records via:
238          *
239          *     GET /collection/id.xml
240          *     GET /collection.xml
241          */
242         public function find ($id = false, $options = array ()) {
243                 if (! $id) {
**244                         $id = $this->_data['id'];**
245                 }
246                 $options_string = '';
247                 if (count ($options) > 0) {
248                         $options_string = '?' . http_build_query ($options);
249                 }
250                 if ($id == 'all' || $id == false) {
251                         // URL/plural.xml?someparam=1
252                         $url = $this->site . $this->element_name_plural . '.xml';
253                         return $this->_send_and_receive ($url . $options_string, 'GET');
254                 }
255 
256                 // URL/plural/id.xml?someparam=1
257                 return $this->_send_and_receive ($this->site . $this->element_name_plural . '/' . $id . '.xml' . $options_string, 'GET');
258         }
259 

arpad-osvald avatar Jun 12 '23 15:06 arpad-osvald