edamov / pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)
MIT License
380 stars 122 forks source link

PHP Notice: Use of undefined constant CURL_HTTP_VERSION_2 #8

Closed dfeng99 closed 7 years ago

dfeng99 commented 7 years ago

When I run the unit test, it reports error -> PHP Notice: Use of undefined constant CURL_HTTP_VERSION_2.

I run a system with ubuntu 14.04, php7.1 curl info as below:

cURL support => enabled cURL Information => 7.52.1 Age => 3 Features AsynchDNS => No CharConv => No Debug => No GSS-Negotiate => No IDN => No IPv6 => Yes krb4 => No Largefile => Yes libz => Yes NTLM => Yes NTLMWB => Yes SPNEGO => No SSL => Yes SSPI => No TLS-SRP => Yes HTTP2 => Yes Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtmp, rtsp, smb, smbs, smtp, smtps, telnet, tftp Host => x86_64-pc-linux-gnu SSL Version => OpenSSL/1.0.2j ZLib Version => 1.2.8

the cURL lib 7.52.1 is compiled on my system, so after I search the code. I found that instead of CURL_HTTP_VERSION_2 I should use constant CURL_HTTP_VERSION_2_0

curl extension obviously uses different form of that constant but not mentioned in any of the php documents. So, make a condition check in your code will help.

ThibaultVlacich commented 7 years ago

Same problem here, but I have one more notice than you have.

Notice: Use of undefined constant CURLPIPE_MULTIPLEX - assumed 'CURLPIPE_MULTIPLEX' in .../vendor/edamov/pushok/src/Client.php on line 62

Notice: Use of undefined constant CURL_HTTP_VERSION_2 - assumed 'CURL_HTTP_VERSION_2' in .../vendor/edamov/pushok/src/Request.php on line 67
TejalN commented 7 years ago

Getting Same problem Use of undefined constant CURLPIPE_MULTIPLEX - assumed 'CURLPIPE_MULTIPLEX'

ThibaultVlacich commented 7 years ago

Answer is here : https://github.com/edamov/pushok/issues/9#issuecomment-280324958

edamov commented 7 years ago

I added this constants in library if they don't exist in php dist