When uploading via HTMLEditorField "Warning Line 247 in /framework/api/RestfulService.php"
Opened this issue · 0 comments
danrye commented
Below is the dump, this is originating from /admin/pages/edit/EditorToolbar/viewfile but only happens when the asset is uploaded to S3
ERROR [Warning]: curl_setopt(): supplied argument is not a valid File-Handle resource
IN GET /admin/pages/edit/EditorToolbar/viewfile?ID=92
Line 247 in /Users/drye/Development/Crossroads/Milacron/SS-CMS/framework/api/RestfulService.php
Source
======
238: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
239: curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
240: curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->getConnectTimeout());
241: if(!ini_get('open_basedir')) curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
242: curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
243:
244:
245: // Write headers to a temporary file
246: $headerfd = tmpfile();
* 247: curl_setopt($ch, CURLOPT_WRITEHEADER, $headerfd);
248:
249: // Add headers
250: if($this->customHeaders) {
251: $headers = array_merge((array)$this->customHeaders, (array)$headers);
252: }
253:
Trace
=====
curl_setopt(Resource id #429,10029,)
RestfulService.php:247
RestfulService->curlRequest(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png,GET,,,Array)
RestfulService.php:195
RestfulService->request()
Oembed.php:107
Oembed::autodiscover_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png)
Oembed.php:147
Oembed::get_oembed_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png)
HtmlEditorField.php:928
HtmlEditorField_Embed->__construct(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png,CloudImage)
HtmlEditorField.php:516
HtmlEditorField_Toolbar->viewfile(SS_HTTPRequest)
RequestHandler.php:288
RequestHandler->handleAction(SS_HTTPRequest,viewfile)
RequestHandler.php:200
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:222
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153
Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:443
LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:93
AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153
Director::direct(/admin/pages/edit/EditorToolbar/viewfile,DataModel)
main.php:177
ERROR [Warning]: rewind() expects parameter 1 to be resource, boolean given
IN GET /admin/pages/edit/EditorToolbar/viewfile?ID=92
Line 284 in /Users/drye/Development/Crossroads/Milacron/SS-CMS/framework/api/RestfulService.php
Source
======
275: curl_setopt_array($ch, $this->proxy);
276: }
277:
278: // Set any custom options passed to the request() function
279: curl_setopt_array($ch, $curlOptions);
280:
281: // Run request
282: $body = curl_exec($ch);
283:
* 284: rewind($headerfd);
285: $headers = stream_get_contents($headerfd);
286: fclose($headerfd);
287:
288: $response = $this->extractResponse($ch, $headers, $body);
289: curl_close($ch);
290:
Trace
=====
rewind()
RestfulService.php:284
RestfulService->curlRequest(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png,GET,,,Array)
RestfulService.php:195
RestfulService->request()
Oembed.php:107
Oembed::autodiscover_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png)
Oembed.php:147
Oembed::get_oembed_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png)
HtmlEditorField.php:928
HtmlEditorField_Embed->__construct(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png,CloudImage)
HtmlEditorField.php:516
HtmlEditorField_Toolbar->viewfile(SS_HTTPRequest)
RequestHandler.php:288
RequestHandler->handleAction(SS_HTTPRequest,viewfile)
RequestHandler.php:200
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:222
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153
Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:443
LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:93
AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153
Director::direct(/admin/pages/edit/EditorToolbar/viewfile,DataModel)
main.php:177
ERROR [Warning]: stream_get_contents() expects parameter 1 to be resource, boolean given
IN GET /admin/pages/edit/EditorToolbar/viewfile?ID=92
Line 285 in /Users/drye/Development/Crossroads/Milacron/SS-CMS/framework/api/RestfulService.php
Source
======
276: }
277:
278: // Set any custom options passed to the request() function
279: curl_setopt_array($ch, $curlOptions);
280:
281: // Run request
282: $body = curl_exec($ch);
283:
284: rewind($headerfd);
* 285: $headers = stream_get_contents($headerfd);
286: fclose($headerfd);
287:
288: $response = $this->extractResponse($ch, $headers, $body);
289: curl_close($ch);
290:
291: return $response;
Trace
=====
stream_get_contents()
RestfulService.php:285
RestfulService->curlRequest(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png,GET,,,Array)
RestfulService.php:195
RestfulService->request()
Oembed.php:107
Oembed::autodiscover_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png)
Oembed.php:147
Oembed::get_oembed_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png)
HtmlEditorField.php:928
HtmlEditorField_Embed->__construct(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png,CloudImage)
HtmlEditorField.php:516
HtmlEditorField_Toolbar->viewfile(SS_HTTPRequest)
RequestHandler.php:288
RequestHandler->handleAction(SS_HTTPRequest,viewfile)
RequestHandler.php:200
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:222
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153
Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:443
LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:93
AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153
Director::direct(/admin/pages/edit/EditorToolbar/viewfile,DataModel)
main.php:177
ERROR [Warning]: fclose() expects parameter 1 to be resource, boolean given
IN GET /admin/pages/edit/EditorToolbar/viewfile?ID=92
Line 286 in /Users/drye/Development/Crossroads/Milacron/SS-CMS/framework/api/RestfulService.php
Source
======
277:
278: // Set any custom options passed to the request() function
279: curl_setopt_array($ch, $curlOptions);
280:
281: // Run request
282: $body = curl_exec($ch);
283:
284: rewind($headerfd);
285: $headers = stream_get_contents($headerfd);
* 286: fclose($headerfd);
287:
288: $response = $this->extractResponse($ch, $headers, $body);
289: curl_close($ch);
290:
291: return $response;
292: }
Trace
=====
fclose()
RestfulService.php:286
RestfulService->curlRequest(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png,GET,,,Array)
RestfulService.php:195
RestfulService->request()
Oembed.php:107
Oembed::autodiscover_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png)
Oembed.php:147
Oembed::get_oembed_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png)
HtmlEditorField.php:928
HtmlEditorField_Embed->__construct(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2014-11-21-at-3.15.24-AM.png,CloudImage)
HtmlEditorField.php:516
HtmlEditorField_Toolbar->viewfile(SS_HTTPRequest)
RequestHandler.php:288
RequestHandler->handleAction(SS_HTTPRequest,viewfile)
RequestHandler.php:200
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:222
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153
Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:443
LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:93
AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153
Director::direct(/admin/pages/edit/EditorToolbar/viewfile,DataModel)
main.php:177