File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -93,8 +93,15 @@ function getShortUrl() {
9393 curl_setopt ($ ch , CURLOPT_HTTPHEADER , array ('Content-Type:application/json ' ));
9494 curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , true );
9595 $ result = curl_exec ($ ch );
96+
97+ if ($ result === false ) {
98+ throw new Exception (curl_error ($ ch ), curl_errno ($ ch ));
99+ }
100+
96101 curl_close ($ ch );
97- return json_decode ($ result , true )['url ' ];
102+ // Note: do not dereference json_decode directly for 5.3 compatibility.
103+ $ ret = json_decode ($ result , true );
104+ return $ ret ['url ' ];
98105 }
99106
100107 function toBinary () {
Original file line number Diff line number Diff line change @@ -121,3 +121,6 @@ $chart->toFile('/tmp/myfile.png')
121121
122122Checkout the ` examples ` directory to see other usage.
123123
124+ ## Note to PHP5 users
125+
126+ This package requires curl and json modules.
You can’t perform that action at this time.
0 commit comments