php-general Digest 15 Sep 2011 11:54:26 -0000 Issue 7479

2011-09-15 Thread php-general-digest-help

php-general Digest 15 Sep 2011 11:54:26 - Issue 7479

Topics (messages 314858 through 314867):

Re: Querying a database for 50 users' information: 50 queries or a WHERE array?
314858 by: Dotan Cohen
314859 by: Alex Nikitin

Re: What would you like to see in most in a text editor?
314860 by: Jonesy

Dereferencing an array.
314861 by: Richard Quadling
314862 by: Alex Nikitin

Re: Repetitive answers . . .
314863 by: Joshua Stoutenburg
314865 by: Nathan Nobbe

Re: Sort problem
314864 by: yeer tai
314867 by: Marc Guay

innerHTML triple quotes issue
314866 by: Grega Leskovšek

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
On Wed, Sep 14, 2011 at 21:01, Alex Nikitin niks...@gmail.com wrote:
 You can use a limit with a nested select, you just can't use it in
 some cases, like inside an IN statement, but something like this
 should work:

 SELECT id, data, etc FROM table JOIN (SELECT special_id as id FROM
 special_table ORDER BY special_id LIMIT 0, 1000) AS table2 USING (id)

 Note: syntax may not be valid, but should be fairly straight forward
 to fix, have no time to play with it though...


Thanks.

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
---End Message---
---BeginMessage---
rant from=tired of constantly having to explain it, developer
MySQL real escape string doesn't work, it's a bad solution to the
problem that has been with the internets since the very beginning, and
if people program like they are taught to by books, doesn't look like
it's going away any time soon. The problem of course is that various
programming languages don't know how to talk to other languages, and
we as devs see no better way to do this then concatenate strings.
Basically this is the core reason why XSS and SQL injection is rampant
on the interwebs. Escaping only seems like it's a good idea to you,
but if you analyze what it does and compare it to today's technology,
you quickly realize how wrong of a concept it actually is. Escaping
looks for certain characters, and if found escapes them in some form.
The problem here is that rather then say defining all safe characters,
it defines what the developers believe to be bad characters, and the
affect that you get is not dissimilar to creating a firewall rule set
where the bottom rule is accept all, as long as my character doesn't
match what they thought was a bad character, it is allowed. This was
fine in the days of ASCII, but the tubes are hardly ASCII anymore,
with Unicode, UTF-16, i have 1,112,064 code points, they are not even
called characters anymore, because they really aren't. And if you are
familiar with best-fit mapping, you would know that there are now
dozens of characters that can represent any single symbol in ASCII,
meaning that using the above type of blocking mechanisms is silly and
technically insecure.

Another problem with it is the fact that security-wise this again is a
bad solution from another perspective. A programmer comes in, and
starts debugging code, the first thing they always seem to do is to
turn off the security and comment out the escape line, and you know
what happens, the bug gets found and fixed completely else-where, but
the security never gets re-enabled. This is called failing open, and
it again goes with the concept above where the escape in itself fails
open as well.

So if you look into the problem at the core, what you have are two
types of code, code that you know is good, and crap data that you have
to somehow make safe. So you know how you do it in the same language?
Right, you assign that data to a storage container called a variable,
and the interpreter knows that this data here, i execute, and that
data there i use as data and don't execute. Well what happens when you
add another language into the mix? Well language a passes known good
code that it string concatenates to bad code, and what you get as a
result is the second language parser thinking hey, all of this stuff
is good code, let me execute it!... This is why a stringent delimiter
between known good and not good data needs to be portrayed to the
second language.

How do we do it with SQL? There are a few ways, one of the more common
ones is to use a prepared statement, this clearly separates the code
from the data for the SQL interpreter on the other side. This works
really well, with one HUGE down-side, it can be a REAL pain in the
butt to use, the more complex your query gets, the more pain in the
butt it is to use prepared statements.

Another way, and this works for mostly any language is to use an
in-common function that jumbles the known-bad data on one end, and

php-general Digest 16 Sep 2011 00:46:47 -0000 Issue 7480

2011-09-15 Thread php-general-digest-help

php-general Digest 16 Sep 2011 00:46:47 - Issue 7480

Topics (messages 314868 through 314884):

Re: Sort problem
314868 by: yeer tai

lost return value during a static call
314869 by: chamila gayan
314872 by: Robert Williams
314873 by: Richard Quadling

Re: Stop PHP execution on client connection closed
314870 by: Marco Lanzotti

Re: innerHTML triple quotes issue
314871 by: Jen Rasmussen
314874 by: Andrew Ballard

XML enabled but not working
314875 by: Matthew Pounsett
314881 by: tamouse mailing lists

Bug?
314876 by: Igor Escobar
314877 by: Daniel Brown
314878 by: Igor Escobar
314879 by: Shawn McKenzie
314880 by: Igor Escobar
314882 by: tamouse mailing lists
314883 by: Tim Streater

Re: Repetitive answers . . .
314884 by: Jason Pruim

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---


Yeah well, it is indeed sometimes, for someone a bit sleepy yet rather 
responsible hehe. Btw, m new here, need to get my head around soon i guess. 
Cheers. 



 From: marc.g...@gmail.com
 Date: Thu, 15 Sep 2011 07:54:00 -0400
 CC: php-gene...@lists.php.net
 Subject: Re: [PHP] Re: Sort problem
 
  use natsort.
 
 For the repetitive answers specialists:  Is it possible that 15
 hours later someone is still only seeing the original question?
 
 Marc
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  ---End Message---
---BeginMessage---
hi All,

I'm seeing a weired behavior in following code http://pastebin.com/B5q8i1RY

when it goes through 2 static methods, at some point it stops returning
value to the calling method. (please see comments in-line).

may be I'm doing this in a wrong way so your suggestions are  welcome. And I
really appreciate if someone can explain how 'return' behaves with static
methods specially when they are called recursively.   thanks a bunch

chamila
---End Message---
---BeginMessage---

On Sep 15, 2011, at 6:03, chamila gayan cgcham...@gmail.com wrote:

 when it goes through 2 static methods, at some point it stops returning
 value to the calling method. (please see comments in-line).

The getArray() method and the 'else' portion of the getChild() method both lack 
a return statement, so they're basically just tossing out whatever value they 
come up with.

--
Bob Williams

Notice: This communication, including attachments, may contain information that 
is confidential. It constitutes non-public information intended to be conveyed 
only to the designated recipient(s). If the reader or recipient of this 
communication is not the intended recipient, an employee or agent of the 
intended recipient who is responsible for delivering it to the intended 
recipient, or if you believe that you have received this communication in 
error, please notify the sender immediately by return e-mail and promptly 
delete this e-mail, including attachments without reading or saving them in any 
manner. The unauthorized use, dissemination, distribution, or reproduction of 
this e-mail, including attachments, is prohibited and may be unlawful. If you 
have received this email in error, please notify us immediately by e-mail or 
telephone and delete the e-mail and the attachments (if any).
---End Message---
---BeginMessage---
On 15 September 2011 14:01, chamila gayan cgcham...@gmail.com wrote:
 hi All,

 I'm seeing a weired behavior in following code http://pastebin.com/B5q8i1RY

 when it goes through 2 static methods, at some point it stops returning
 value to the calling method. (please see comments in-line).

 may be I'm doing this in a wrong way so your suggestions are  welcome. And I
 really appreciate if someone can explain how 'return' behaves with static
 methods specially when they are called recursively.   thanks a bunch

 chamila


New pastie http://pastebin.com/AnZ1r7yR
Output is ...
Z:\ppp.php 108parentclass::getChild 29parentclass::getChild
40parentclass::getArray 22parentclass::getChild
29parentclass::getChild 32parentclass::childload
6parentclass::childload 9childA::__construct 54childA::setA
67childA::setA 69childA::__construct 56parentclass::getChild 34childA
Object(   [a:childA:private] = 1)parentclass::getArray
24parentclass::getChild 42parentclass::getChild 44Z:\ppp.php
110Z:\ppp.php 112
Using PHP 5.3.9-dev on Win32.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea
---End Message---
---BeginMessage---
Il 14/09/2011 19:34, Alex Nikitin ha scritto:
 Perhaps if I, or we can understand your application 

[PHP] Re: Sort problem

2011-09-15 Thread yeer tai


use natsort.

  

Re: [PHP] Re: Repetitive answers . . .

2011-09-15 Thread Nathan Nobbe
On Wed, Sep 14, 2011 at 10:06 PM, Joshua Stoutenburg
jehoshu...@gmail.comwrote:

 On Wed, Sep 14, 2011 at 11:59 AM, Govinda govinda.webdnat...@gmail.com
 wrote:
  As for duplicate answers...,
 
  [snip]
 
 
  Also newbies may tend to like the multiples answers.. for the different
 perspectives, as Dan said, but also when they are exact dupe answers -
 because then the newbie knows the answer is definitive.. and then stops
 asking the list.. and starts doing what work is called for.
 
  -Govinda
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 That's a good point.  The absence of objection to a provided answer
 doesn't necessarily make it definitive since it could just be the
 masses passed over the conversation.  Therefore, yes, duplicate
 answers are a good thing.

 Thanks everybody for your patience in helping this mailing list
 newcomer understand how things work.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


wait, it sounds like we could use another answer .., yes ppl like to answer
things many times here, often with almost identical suggestions, and many
spins on how to approach the problem, including alternative perspectives on
life..; the ebb--flow of php-general ;)

-nathan


Re: [PHP] Re: Sort problem

2011-09-15 Thread Marc Guay
 use natsort.

For the repetitive answers specialists:  Is it possible that 15
hours later someone is still only seeing the original question?

Marc

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Sort problem

2011-09-15 Thread yeer tai


Yeah well, it is indeed sometimes, for someone a bit sleepy yet rather 
responsible hehe. Btw, m new here, need to get my head around soon i guess. 
Cheers. 



 From: marc.g...@gmail.com
 Date: Thu, 15 Sep 2011 07:54:00 -0400
 CC: php-general@lists.php.net
 Subject: Re: [PHP] Re: Sort problem
 
  use natsort.
 
 For the repetitive answers specialists:  Is it possible that 15
 hours later someone is still only seeing the original question?
 
 Marc
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  

[PHP] lost return value during a static call

2011-09-15 Thread chamila gayan
hi All,

I'm seeing a weired behavior in following code http://pastebin.com/B5q8i1RY

when it goes through 2 static methods, at some point it stops returning
value to the calling method. (please see comments in-line).

may be I'm doing this in a wrong way so your suggestions are  welcome. And I
really appreciate if someone can explain how 'return' behaves with static
methods specially when they are called recursively.   thanks a bunch

chamila


Re: [PHP] Stop PHP execution on client connection closed

2011-09-15 Thread Marco Lanzotti
Il 14/09/2011 19:34, Alex Nikitin ha scritto:
 Perhaps if I, or we can understand your application a little better,
 we could suggest better solutions, just remember that you are not the
 first person to have to solve these similar issues. I can help you if
 you want, glimpse over your database design and queries for a fresh
 look, i have fairly extensive php (and many other languages)
 programming experience, as well as database design and administration,
 system development and administration, optimization, security, caching
 (many other things, that don't directly pertain to this) though we
 should probably keep it off the list. 

Table and queries are very simple.
Table is like this:

CREATE TABLE `TABLE1` (
  `ID` int unsigned NOT NULL,
  `Service` char(2) NOT NULL,
  `Lang` char(2) NOT NULL,
  `Text1` varchar(100) DEFAULT NULL,
  `Char1` char(1) NOT NULL,
  `Date1` date NOT NULL,
  `Num1` int unsigned NOT NULL,
  `Num2` smallint unsigned NOT NULL,
  `Num3` smallint unsigned NOT NULL,
  `Num4` tinyint unsigned NOT NULL,
  `Num5` int unsigned NOT NULL,
  `Num6` tinyint NOT NULL,
  `Num7` int unsigned NOT NULL,
  PRIMARY KEY (`ID`,`Service`,`Lang`),
  KEY `index_1` (`Char1`),
  KEY `index_2` (`Date1`),
  KEY `index_3` (`Num1`),
  KEY `index_4` (`Num2`),
  KEY `index_5` (`Num3`),
  KEY `index_6` (`Num4`),
  KEY `index_7` (`Num5`),
  KEY `index_8` (`Num6`),
  KEY `index_9` (`Num7`),
  KEY `index_10` (`Text1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

And this is an example query:

SELECT COUNT(*)
FROM TABLE1
WHERE Char1='A'
AND Num2=10

The WHERE clause can contain any indexed column.

Bye,
Marco

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] innerHTML triple quotes issue

2011-09-15 Thread Jen Rasmussen
Grega,

Do you HAVE TO use PHP to echo the output or can you just write it in HTML? It 
seems much simpler and if 
so... below will work. The code is not indented properly but I did this so you 
can see what's going on. 

HTML VERSION
h3My Heavenly profession is being/h3
span class=see 
onmouseover=this.innerHTML='img 
src=\'http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpg\' /' 
onmouseout=this.innerHTML='an angel'

an angel/span

Hope that helps, cheers! 
Jen




-Original Message-
From: Grega Leskovšek [mailto:legr...@gmail.com] 
Sent: Thursday, September 15, 2011 4:01 AM
To: php-general
Subject: [PHP] innerHTML triple quotes issue

h3My Heavenly profession is being span class=see
onmouseover='?php echo this.innerHTML=' img
src=\http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpg\;
alt =\close to my heavenly face\ /';?'
onmouseout=this.innerHTML='an angel'an angel/span,


I first tried this but got a mistake and then I tried to use php to
settle this look above, but got parsing mistake.

although not fully liberated I came to work in this world for span class=see
onmouseover=this.innerHTML='img
src=\http://t1.gstatic.com/images?q=tbn:ANd9GcTaxIC0HvMMWTlZ2ozXMcwTsqRcStUXRWItISeVyDrVkzVtv2s-AVmn6v3x\;
alt =\Lord Krishna in His garden of flowers, that's a spiritual world\ /'
onmouseout=this.innerHTML='Lord Krishna\'s Realisation.'Lord
Krishna's Realisation./span/h3


Could YOu please look a t my code and exlpain me what to do if I need
to use triple quotoes - we only have  and '  in onmouseover 1,
thisINNERHTML 2 and in src 3

Please help me!

♥♥♥ When the sun rises I receive and when it sets I forgive! ♥♥♥
˜♥ - http://moj.skavt.net/gleskovs/ - ♥ Always, Grega Leskovšek

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] lost return value during a static call

2011-09-15 Thread Robert Williams

On Sep 15, 2011, at 6:03, chamila gayan cgcham...@gmail.com wrote:

 when it goes through 2 static methods, at some point it stops returning
 value to the calling method. (please see comments in-line).

The getArray() method and the 'else' portion of the getChild() method both lack 
a return statement, so they're basically just tossing out whatever value they 
come up with.

--
Bob Williams

Notice: This communication, including attachments, may contain information that 
is confidential. It constitutes non-public information intended to be conveyed 
only to the designated recipient(s). If the reader or recipient of this 
communication is not the intended recipient, an employee or agent of the 
intended recipient who is responsible for delivering it to the intended 
recipient, or if you believe that you have received this communication in 
error, please notify the sender immediately by return e-mail and promptly 
delete this e-mail, including attachments without reading or saving them in any 
manner. The unauthorized use, dissemination, distribution, or reproduction of 
this e-mail, including attachments, is prohibited and may be unlawful. If you 
have received this email in error, please notify us immediately by e-mail or 
telephone and delete the e-mail and the attachments (if any).

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] lost return value during a static call

2011-09-15 Thread Richard Quadling
On 15 September 2011 14:01, chamila gayan cgcham...@gmail.com wrote:
 hi All,

 I'm seeing a weired behavior in following code http://pastebin.com/B5q8i1RY

 when it goes through 2 static methods, at some point it stops returning
 value to the calling method. (please see comments in-line).

 may be I'm doing this in a wrong way so your suggestions are  welcome. And I
 really appreciate if someone can explain how 'return' behaves with static
 methods specially when they are called recursively.   thanks a bunch

 chamila


New pastie http://pastebin.com/AnZ1r7yR
Output is ...
Z:\ppp.php 108parentclass::getChild 29parentclass::getChild
40parentclass::getArray 22parentclass::getChild
29parentclass::getChild 32parentclass::childload
6parentclass::childload 9childA::__construct 54childA::setA
67childA::setA 69childA::__construct 56parentclass::getChild 34childA
Object(   [a:childA:private] = 1)parentclass::getArray
24parentclass::getChild 42parentclass::getChild 44Z:\ppp.php
110Z:\ppp.php 112
Using PHP 5.3.9-dev on Win32.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] innerHTML triple quotes issue

2011-09-15 Thread Andrew Ballard
On Thu, Sep 15, 2011 at 5:01 AM, Grega Leskovšek legr...@gmail.com wrote:

 h3My Heavenly profession is being span class=see
 onmouseover='?php echo this.innerHTML=' img
 src=\http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpg\;
 alt =\close to my heavenly face\ /';?'
 onmouseout=this.innerHTML='an angel'an angel/span,


 I first tried this but got a mistake and then I tried to use php to
 settle this look above, but got parsing mistake.


It's easy to forget that, although you are embedding JavaScript in the
onmouseover and onmouseout attributes of the element, the content of
those attributes is still technically HTML, so the single and double
quotes as well as the tag angle brackets inside the attribute should
probably be the HTML entities (quot; apos; lt; and gt;) instead of
the literal characters. This avoids the issue with nesting and
escaping quotes across three languages (PHP - HTML - Javascript).


Of course, when testing this, my first attempt worked in Firefox,
Opera, Safari and Chrome but failed in IE (version 8). (Go figure)

span class=see
onmouseover=this.innerHTML=apos;lt;brgt;lt;img
src=quot;http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpgquot;
/apos;
onmouseout=this.innerHTML=apos;an angelapos;

an angel/span



So then I tried a mixed approach and it seems to work in all of them:

span class=see
onmouseover=this.innerHTML='lt;brgt;lt;img
src=quot;http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpgquot;
/'
onmouseout=this.innerHTML='an angel'

an angel/span


YMMV

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] XML enabled but not working

2011-09-15 Thread Matthew Pounsett

I seems to behaving issues with php5 on one particular server, and I haven't 
been able to find the issue.  Basically, php says XML is enabled, but xml 
functions are missing.

 php -i | grep XML support
libXML support = active

 echo ? print xml_parser_create(''); ? | php
Fatal error: Call to undefined function xml_parser_create() in - on line 1

The machine in question is FreeBSD 8.2-RELEASE running the most recent ports of 
php5 and expat.

 php -v
PHP 5.3.8 with Suhosin-Patch (cli) (built: Sep 15 2011 13:58:49) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

 sudo portversion -v expat
expat-2.0.1_2   =  up-to-date with port 

What's baffling is that this is a basically identical configuration to another 
server where php is behaving just fine.  I haven't been able to find the 
variation yet.  

Anyone have any thoughts on what to look at?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Bug?

2011-09-15 Thread Igor Escobar
Anyone can explain this?

https://gist.github.com/1220404

Part of the code are in portuguese so...
iguais = equal
diferentes = different

Regards,
Igor Escobar
*Software Engineer
*
+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar http://www.twitter.com/igorescobar


Re: [PHP] Bug?

2011-09-15 Thread Daniel Brown
On Thu, Sep 15, 2011 at 17:07, Igor Escobar titiolin...@gmail.com wrote:
 Anyone can explain this?

 https://gist.github.com/1220404

 Part of the code are in portuguese so...
 iguais = equal
 diferentes = different

About this part are you confused?

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Bug?

2011-09-15 Thread Igor Escobar
I'm confused about the output of the code... very disturbed. But
@*augustohphttps://gist.github.com/augustohp
*  already respond the question on the gist thread (in portuguese) and
explained why those results.


Regards,
Igor Escobar
*Software Engineer
*
+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar http://www.twitter.com/igorescobar





On Thu, Sep 15, 2011 at 6:17 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, Sep 15, 2011 at 17:07, Igor Escobar titiolin...@gmail.com wrote:
  Anyone can explain this?
 
  https://gist.github.com/1220404
 
  Part of the code are in portuguese so...
  iguais = equal
  diferentes = different

 About this part are you confused?

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/



[PHP] Re: Bug?

2011-09-15 Thread Shawn McKenzie
On 09/15/2011 04:07 PM, Igor Escobar wrote:
 Anyone can explain this?
 
 https://gist.github.com/1220404
 
 Part of the code are in portuguese so...
 iguais = equal
 diferentes = different
 
 Regards,
 Igor Escobar
 *Software Engineer
 *
 + http://blog.igorescobar.com
 + http://www.igorescobar.com
 + @igorescobar http://www.twitter.com/igorescobar
 

1. Obviously because of the issues with floating point precision these
are stored as the same float, a la your next example.

2. Using bc math for binary calculations on string representations of a
number overcomes the problems in 1.

3. This one is peculiar, but it seems that since they are numeric
strings that they are being juggled to float for the comparison since
using == there is no type checking.  Using === yields a different
result, presumably because forcing a type check compares them as
strings.  Use strcmp() to overcome this.

4. Do I need to explain this one?

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Bug?

2011-09-15 Thread Igor Escobar
Thank you guys.


Regards,
Igor Escobar
*Software Engineer
*
+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar http://www.twitter.com/igorescobar





On Thu, Sep 15, 2011 at 6:32 PM, Shawn McKenzie nos...@mckenzies.netwrote:

 On 09/15/2011 04:07 PM, Igor Escobar wrote:
  Anyone can explain this?
 
  https://gist.github.com/1220404
 
  Part of the code are in portuguese so...
  iguais = equal
  diferentes = different
 
  Regards,
  Igor Escobar
  *Software Engineer
  *
  + http://blog.igorescobar.com
  + http://www.igorescobar.com
  + @igorescobar http://www.twitter.com/igorescobar
 

 1. Obviously because of the issues with floating point precision these
 are stored as the same float, a la your next example.

 2. Using bc math for binary calculations on string representations of a
 number overcomes the problems in 1.

 3. This one is peculiar, but it seems that since they are numeric
 strings that they are being juggled to float for the comparison since
 using == there is no type checking.  Using === yields a different
 result, presumably because forcing a type check compares them as
 strings.  Use strcmp() to overcome this.

 4. Do I need to explain this one?

 --
 Thanks!
 -Shawn
 http://www.spidean.com



Re: [PHP] XML enabled but not working

2011-09-15 Thread tamouse mailing lists
On Thu, Sep 15, 2011 at 3:20 PM, Matthew Pounsett m...@conundrum.com wrote:
 echo ? print xml_parser_create(''); ? | php

Not anything to do with the problem, but you can just write:

  php -r print xml_parser_create('');

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Fwd: [PHP] Bug?

2011-09-15 Thread tamouse mailing lists
Hit reply instead of reply-all /o\


-- Forwarded message --
From: tamouse mailing lists tamouse.li...@gmail.com
Date: Thu, Sep 15, 2011 at 4:39 PM
Subject: Re: [PHP] Bug?
To: Igor Escobar titiolin...@gmail.com


On Thu, Sep 15, 2011 at 4:07 PM, Igor Escobar titiolin...@gmail.com wrote:
 Anyone can explain this?

 https://gist.github.com/1220404

For the floats, http://us2.php.net/operators.comparison makes it
pretty clear (and this has been a well-known thing about floats as far
back as Uni for me, in 1979).

The string thing is noted in PHP as far back as 2004:

http://us2.php.net/manual/en/language.types.string.php#41986

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Fwd: [PHP] Bug?

2011-09-15 Thread Tim Streater
On 15 Sep 2011 at 22:43, tamouse mailing lists tamouse.li...@gmail.com wrote: 

 For the floats, http://us2.php.net/operators.comparison makes it
 pretty clear (and this has been a well-known thing about floats as far
 back as Uni for me, in 1979).

The fact that floating point hardware has limited precision has been known ever 
since the first such hardware in the mid-1950's, in fact.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: Repetitive answers . . .

2011-09-15 Thread Jason Pruim

Jason Pruim
li...@pruimphotography.com



On Sep 15, 2011, at 3:22 AM, Nathan Nobbe wrote:

 On Wed, Sep 14, 2011 at 10:06 PM, Joshua Stoutenburg
 jehoshu...@gmail.comwrote:
 
 On Wed, Sep 14, 2011 at 11:59 AM, Govinda govinda.webdnat...@gmail.com
 wrote:
 As for duplicate answers...,
 
 [snip]
 
 
 Also newbies may tend to like the multiples answers.. for the different
 perspectives, as Dan said, but also when they are exact dupe answers -
 because then the newbie knows the answer is definitive.. and then stops
 asking the list.. and starts doing what work is called for.
 
 -Govinda
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 That's a good point.  The absence of objection to a provided answer
 doesn't necessarily make it definitive since it could just be the
 masses passed over the conversation.  Therefore, yes, duplicate
 answers are a good thing.
 
 Thanks everybody for your patience in helping this mailing list
 newcomer understand how things work.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 wait, it sounds like we could use another answer .., yes ppl like to answer
 things many times here, often with almost identical suggestions, and many
 spins on how to approach the problem, including alternative perspectives on
 life..; the ebb--flow of php-general ;)

I've always thought that getting a couple fairly similar answers to the same 
question helped to validate the answer for someone who is in the early process 
of learning ;)
 
 -nathan


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Repetitive answers . . .

2011-09-15 Thread Joshua Stoutenburg
On Thu, Sep 15, 2011 at 5:46 PM, Jason Pruim

 I've always thought that getting a couple fairly similar answers to the same 
 question helped to validate the answer for someone who is in the early 
 process of learning ;)

 -nathan



Yeah, you know, I think you are right! I'd like to answer this
question the same way, even though half a dozen have already answered
it the same way.

But let me put a spin on it:

?php

$information = EOF

I got a great idea, why don't we write hundreds of books and websites
with all of our repetitive answers and call it the information age.
Who cares if all the priceless pearls of rare knowledge are buried,
lost, and irretrievable.  We'll have the information age!

Then, after we've ushered in the information age, we'll invent a
search bot to crawl all over the heap of information and fling it
around whenever somebody asks for it!

Then, we'll all sit around on a mailing list, and when somebody comes
in seeking refuge from the flinging search bot, looking for some rare
piece of information, we'll fling all the common stuff at him instead!
 It will be hilarious!

EOF;


class baboon
{
$ammo = '';

public __construct($ammo)
{
$this-ammo = $ammo;
}

public function flingAt($target)
{
$target-flingAlert($this-ammo);
}
}


$me = new baboon($information);
$you = new baboon();
$me-flingAt($you);


// I hope everyone finds this more humorous than offensive.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 5.4.0beta1 released

2011-09-15 Thread d...@php.net
Hello!





Stas has packed PHP 5.4.0beta1 which you can find here:





   http://downloads.php.net/stas/





The Windows team provides windows binaries which you find here:

http://windows.php.net/qa/





Please test it carefully, and report any bugs in the bug system, but


only if you have a short reproducable test case. The next beta


will be released on Oct 13.


regards,


Stas and David

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 5.4.0beta1 released

2011-09-15 Thread d...@php.net
Hello!





Stas has packed PHP 5.4.0beta1 which you can find here:





   http://downloads.php.net/stas/





The Windows team provides windows binaries which you find here:

http://windows.php.net/qa/





Please test it carefully, and report any bugs in the bug system, but


only if you have a short reproducable test case. The next beta


will be released on Oct 13.


regards,


Stas and David

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 5.4.0beta1 released

2011-09-15 Thread d...@php.net
Hello!





Stas has packed PHP 5.4.0beta1 which you can find here:





   http://downloads.php.net/stas/





The Windows team provides windows binaries which you find here:

http://windows.php.net/qa/





Please test it carefully, and report any bugs in the bug system, but


only if you have a short reproducable test case. The next beta


will be released on Oct 13.


regards,


Stas and David

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 5.4.0beta1 released

2011-09-15 Thread d...@php.net
Hello!





Stas has packed PHP 5.4.0beta1 which you can find here:





   http://downloads.php.net/stas/





The Windows team provides windows binaries which you find here:

http://windows.php.net/qa/





Please test it carefully, and report any bugs in the bug system, but


only if you have a short reproducable test case. The next beta


will be released on Oct 13.


regards,


Stas and David

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.4.0beta1 released

2011-09-15 Thread Sharl.Jimh.Tsin
在 2011-09-16五的 03:50 +0200,d...@php.net写道:
 Hello!
 
 
 
 
 
 Stas has packed PHP 5.4.0beta1 which you can find here:
 
 
 
 
 
http://downloads.php.net/stas/
 
 
 
 
 
 The Windows team provides windows binaries which you find here:
 
 http://windows.php.net/qa/
 
 
 
 
 
 Please test it carefully, and report any bugs in the bug system, but
 
 
 only if you have a short reproducable test case. The next beta
 
 
 will be released on Oct 13.
 
 
 regards,
 
 
 Stas and David
 
WHY post it four times??
-- 
Best regards,
Sharl.Jimh.Tsin (From China **Obviously Taiwan INCLUDED**)

Using Gmail? Please read this important notice:
http://www.fsf.org/campaigns/jstrap/gmail?10073.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.4.0beta1 released

2011-09-15 Thread d...@php.net

 Please test it carefully, and report any bugs in the bug system, but


 only if you have a short reproducable test case. The next beta


 will be released on Oct 13.


 regards,


 Stas and David

 WHY post it four times??

a glitch with my mail server.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php