Date: | 27 Feb 2004 21:34:50 -0000 |
From: | Aaron Sherman (via RT) <perlbug-followup [...] perl.org> |
To: | bugs-bitbucket [...] netlabs.develooper.com |
Subject: | [perl #27187] PHP::Include did not handle comments |
# New Ticket Created by Aaron Sherman
# Please include the string: [perl #27187]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=27187 >
This is a bug report for perl from ajs@ajs.com,
generated with the help of perlbug 1.33 running under perl v5.6.1.
-----------------------------------------------------------------
[Please enter your report here]
PHP::Include did not handle comments or arrays with
(questionable, but still valid) trailing commas. I've got a patch:
--- PHP-Include-0.07.orig/lib/PHP/Include/Vars.pm 2003-11-14 17:39:20.000000000 -0500
+++ PHP-Include-0.07/lib/PHP/Include/Vars.pm 2004-02-27 16:20:20.000000000 -0500
@@ -5,13 +5,21 @@
use Parse::RecDescent;
use Data::Dumper;
+ $::RD_HINT = 1;
+ $::RD_TRACE = undef;
+ $::RD_WARN = 1;
+ $::RD_ERRORS = 1;
+
+
our $perl = '';
my $grammar =
<<'GRAMMAR';
-php_vars: php_start assignment(s) php_end
+php_vars: php_start statement(s) php_end
+
+statement: /\#.*/ | assignment
php_start: /\s*<\?php\s*/
@@ -27,13 +35,13 @@
$return = "my $item[1]=$item[3]";
}
-hash_assign: variable /=/ /Array\s*\(/ pair(s /,/) /\s*\)/
+hash_assign: variable /=/ /Array\s*\(/i pair(s /,/) /\s*(,\s*)?\)/
{
$item[1] =~ s/^\$/%/;
$return = "my $item[1]=(" . join( ',', @{$item[4]} ) . ')';
}
-array_assign: variable /=/ /Array\s*\(/ element(s /,/) /\s*\)/
+array_assign: variable /=/ /Array\s*\(/i element(s /,/) /\s*\)/
{
$item[1] =~ s/^\$/@/;
$return = "my $item[1]=(" . join( ',', @{$item[4]} ) . ')'
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=library
severity=low
---
Site configuration information for perl v5.6.1:
Configured by bhcompile at Mon Aug 18 16:07:35 EDT 2003.
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform:
osname=linux, osvers=2.4.21-1.1931.2.393.entsmp, archname=i386-linux
uname='linux bugs.devel.redhat.com 2.4.21-1.1931.2.393.entsmp #1 smp thu aug 14 14:47:21 edt 2003 i686 unknown '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Uusethreads -Uuseithreads -Uuselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Dinc_version_list=5.6.0/i386-linux 5.6.0'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O2 -march=i386 -mcpu=i686',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.3 2.96-113)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.6.1:
/usr/lib/perl5/5.6.1/i386-linux
/usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i386-linux
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.6.1/i386-linux
/usr/lib/perl5/vendor_perl/5.6.1
/usr/lib/perl5/vendor_perl
.
---
Environment for perl v5.6.1:
HOME=/home/ajs
LANG=C
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/home/ajs/bin
PERL_BADLANG (unset)
SHELL=/bin/bash