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
378 stars 121 forks source link

Notice: Undefined Offset #12

Closed TheDagger closed 7 years ago

TheDagger commented 7 years ago

Notice: Undefined offset: 1","class":"Symfony\Component\Debug\Exception\ContextErrorException","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/public_html\/devsite\/vendor\/edamov\/pushok\/src\/Client.php","line":95

This is what I got from my symfony debugger. Unless I disable errors for notices I can't use the library. Any idea the issue on that line?

TheDagger commented 7 years ago

After reading some of the other comments I got this to work by setting the errors for this part to ignore notices (error_reporting(E_ERROR | E_WARNING | E_PARSE);) and then I upgraded to curl with http2 support. For others that might need the commands in DOCKER this is what I did.

Install curl again but with HTTP-2 Protocol Support Now

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y tmux wget htop RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ g++ make binutils autoconf automake autotools-dev libtool pkg-config \ zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev \ libjemalloc-dev cython python3-dev python-setuptools

RUN git clone https://github.com/tatsuhiro-t/nghttp2.git WORKDIR nghttp2 RUN autoreconf -i RUN automake RUN autoconf RUN ./configure RUN make RUN make install

Upgrades to latest curl for http2 support

WORKDIR ~ RUN apt-get update && apt-get build-dep -y curl RUN wget http://curl.haxx.se/download/curl-7.46.0.tar.bz2 RUN tar -xvjf curl-7.46.0.tar.bz2 WORKDIR curl-7.46.0 RUN ./configure --with-nghttp2=/usr/local --with-ssl RUN make RUN make install RUN ldconfig

This made it work for me :)