PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 13th, 2002, 04:40 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
warn_plus_overloading

i have my php.ini with
log_errors = on
error_log = phperror.log
warn_plus_overloading = on

running PHP4.2.2 on Apache 2.0.39 on Win2k with

<?php
echo 'ab' + 'cd';
?>

produces a 0 (zero) and no warnings in phperror.log


(now that i'm writing this i thought of trying displaying the errors to the output -- will be back in a bit)

how come?
don't warnings get logged?
do i have something misconfigured?

any help appreciated

Reply With Quote
  #2  
Old August 13th, 2002, 04:53 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: warn_plus_overloading

no display of this warning to the screen

Reply With Quote
  #3  
Old August 13th, 2002, 07:06 PM
cjrobs cjrobs is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Southampton, England
Posts: 121 cjrobs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to cjrobs
RE: warn_plus_overloading

yes, it produces no warnings as it is a perfectly valid piece of code (it takes any letters as a 0). What its doing is the math: 0 + 0 = 0.

What i think you are trying to do is produce abcd on the output - to do this you need to use '.' not '+' as follows:
php Code:
Original - php Code
  1.  
  2. <?php
  3. echo('ab'.'cd');
  4. ?>

Reply With Quote
  #4  
Old August 13th, 2002, 08:19 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: warn_plus_overloading

i know it is valid; i thought PHP would say something to avoid nasty errors

http://www.php.net/manual/en/configuration.php#ini.warn-plus-overloading

imagine this:

<?php
$class = 't';
$type = 3;
echo $class . $type; // ok: 't3'
// now imagine i forgot the dot
// and concatenate with '+'
echo $a + $b; // ok: 3 ???
// further imagine this:
$q = 'select * from table where field='' . ($a + $b) . ''';
// and we've got a nasty bug
?>

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > warn_plus_overloading


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway