Skip to content

Instantly share code, notes, and snippets.

@evaisse
Last active March 21, 2017 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evaisse/b02dff1242e55e6eaabcd40c2043cd3b to your computer and use it in GitHub Desktop.
Save evaisse/b02dff1242e55e6eaabcd40c2043cd3b to your computer and use it in GitHub Desktop.
A Docker container to confirm the bug : https://bugs.php.net/bug.php?id=63426
FROM debian
RUN apt-get update && apt-get install -y libapache2-mod-php5 php5-xdebug nano vim
RUN a2enmod php5
RUN rm /var/www/html/index.html
COPY index.php /var/www/html/index.php
COPY test.php /var/www/html/test.php
ADD start.sh /root/start.sh
RUN chmod +x /root/start.sh
EXPOSE 80
CMD ["/root/start.sh"]
<?php
if (@$_GET['txt']) {
foreach (ini_get_all() as $key => $value) {
print "$key = ".json_encode($value)."\n";
}
} else {
phpinfo();
}
#!/bin/bash
source /etc/apache2/envvars
exec apache2 -D FOREGROUND
<?php
header('Charset: utf-8');
try {
// this don't work, you should not even go in the catch block
throw new Exception("C'est pas p" . html_entity_decode("&agrave;t&eacute;", ENT_COMPAT | ENT_HTML401, 'ISO-8859-1'));
// if you skip the first exception, this one is ok will not segfault
throw new Exception("C'est pas p" . html_entity_decode("&agrave;t&eacute;", ENT_COMPAT | ENT_HTML401, 'utf-8'));
} catch (\Exception $e) {
print $e->getMessage();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment