ID: 18590
Comment by: greg at pwsdb dot com
Reported By: armageddon at raydan dot de
Status: No Feedback
Bug Type: Scripting Engine problem
Operating System: WinXP Pro
PHP Version: 5.0.0-dev
New Comment:
system notes:
zencart Version 1.3.8a
Server OS: Linux 2.6.18-53.1.14.el5.centos.plus
HTTP Server: Apache/2.2.3 (CentOS)
PHP Version: 5.1.6 (Zend: 2.1.0)
Previous Comments:
------------------------------------------------------------------------
[2009-02-04 17:22:29] greg at pwsdb dot com
PPS
I now remember a few months ago I added code to a pgm I had written
to access another $_POST variable. I also moved the call to my program
(in includes/modules/pages/checkout_confirmation/header_php.php) down
past some error checking. I immediately started getting "Fatal
error:"
messages about things being defined twice throughout many (untouched)
zc pgms.:
i 'undid' things but could not stop it until I had changed all the
require() calls to require_once()
Fatal error: Cannot redeclare class order in
/.../includes/classes/order.php on line 1018
Fatal error: Cannot redeclare class shipping in
/.../includes/classes/shipping.php on line 178
Fatal error: Cannot redeclare class order_total in
/.../includes/classes/order_total.php on line 232
Fatal error: Cannot redeclare class payment in
/.../includes/classes/payment.php on line 255
Fatal error: Cannot redeclare class cc_validation in
/.../includes/classes/cc_validation.php on line 184
and more.
again, it has to be "php vs. pear" (?)
this was in "PHP Version 5.1.6". From the comments above, it must
still be in Ver. 5.2.4
------------------------------------------------------------------------
[2009-02-04 05:22:00] greg at pwsdb dot com
PPS
no, it is not working in the login page now, either.
Same experience as the others above?:
"First it works, then it doesn't."
------------------------------------------------------------------------
[2009-02-04 03:46:35] greg at pwsdb dot com
PS
This only happened within a checkout page of ZenCart ("part 3 of 3")
and not another (not the login page) ... I don't know enough about zc
to know what the significant difference is.
------------------------------------------------------------------------
[2009-02-04 02:59:23] greg at pwsdb dot com
this experience/test may help:
I defined a function (fff) in the top of my pgm. (not in a loop)
it spanned from line 5 to 11 and used it in the code below.
I got this error msg:
Fatal error: Cannot redeclare fff() (previously declared in
/.../xxx.php:5) in
/.../xxx.php on line 11
I then removed it to an external file (xx-functions.php) and did a
"require_once() for xxx-functions.php on line 6 and got these 2
error messages where there should have only been one.
IT WAS TRYING TO LOAD THE FUNCTION(PGM) TWICE:
Warning: require_once(xxx-functions.php) [function.require-once]:
failed to open stream: No such file or directory in
/.../xxx.php on line 6
Fatal error: require_once() [function.require]: Failed opening required
'xxx-functions.php' (include_path='.:/usr/share/pear') in
/.../xxx.php on line 6
------------------------------------------------------------------------
[2008-05-30 13:48:47] mark dot php dot net dot special at emceesoftware
dot com
As a followup to my last comment, the way this "error" is being
reported proved a little confusing, and my warrant some minor research
in order to help make it a bit easier to identify when it happens.
My error log reports the following (abbreviated):
PHP Fatal error: Cannot redeclare simplehtml_rendercontent()
(previously declared in SimpleHTML.php:149) in SimpleHTML.php on line
152
Noteworthy is the fact that the RenderContent() method is declared on
line 149. The closing brace for the method is on line 152.
It was this difference in line numbers that proved the most confusing.
If they both reported out at line 149, I suspect I would have more
quickly determined that I was seeing a reload problem of some sort.
Also, if after adjusting the line number being reported, it is
determined that they are identical, it might be helpful to post an
additional line in the error log which suggests the developer look at
replacing an include() with include_once() or require() with
require_once().
With that bit of reporting, I suspect most folks who get bit with this
type of issue will be able to resolve it more quickly (whether
dynamically as I've done, or at the top of a PHP file).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/18590
--
Edit this bug report at http://bugs.php.net/?id=18590&edit=1