Re: [PHP] Re: Is this a bug with date() ?
A year can have 52 or 53 weeks and it can begin with week nr 1, 52 or 53 check this algorithm http://www.threesides.se/blogg/2010/04/15/date-calculation-algorithm/ ** Hans Åhlin Tel: +46761488019 icq: 275232967 http://www.kronan-net.com/ irc://irc.freenode.net:6667 - TheCoin ** 2010/6/30 Lester Caine les...@lsces.co.uk: Michael Alaimo wrote: I have found a bug report. This is the correct functionality. Mike I understand that technically there are more than 52 weeks in a year. Well at least google says 1 year = 52.177457 weeks. So I run the command: php echo date('W' , mktime(0, 0, 0, 1, 1, date('Y'))); 53 As you can see the result is 53. Any thoughts on this? http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/1016ca2b-7f43-2b10-8199-a78d1bcc49e9overridelayout=true Covers it nicely ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- 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
[PHP] Re: Is this a bug?
Catalin Zamfir Alexandru, DATAGRAM SRL schrieb: Hello guys, I've been stalking on the list for some time. Didn't have anything to report/talk, until now. I have a code like this, maybe you guys can reproduce it, with output buffering started: Echo 'something'; Echo 'another thing'; Echo 'something br /'\; What happens is that ANYTHING that was echo'ed until that \, will not reach the buffer. Although, this should actually be a Parse Error, it isn't, it just echoes what was echoed after the god damned \. It took me two hours to find this typo in the code . Can you guys reproduce the error? I can actually give you a link to the server where this code runs. Hi, yes this is a Bug in your code ;-) -- Unexpected character in input: '\' (ASCII=92) state=1 in ... This is the Error Output you will see. Regards Carlos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Division [maybe a bug]
2008/5/11 Chris W [EMAIL PROTECTED]: jo opp wrote: Hello! $var1= 2155243640%31104000; $var2= 2147309244%31104000; echo $var1 // Return -24651656 echo $var2 // Return 1133244 $var2 return the correct result, but $var1 is wrong (the correct result is 9067640) Probably because the maximum signed 32 bit integer value is 2,147,483,648 OK, but with bigger numbers works fine again. Right now I made a function to deal with this issue: function remainder($dividend,$divisor){ $remainder= $dividend-(floor($dividend/$divisor)*$divisor); return $remainder; } What do you think about it? if you are dealing with numbers that large, consider using some arbitrary precision math functions that can work with as large of numbers as you need. http://us3.php.net/manual/en/refs.mathcrypto.math.php -- Chris W KE5GIX Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm; Ham Radio Repeater Database. http://hrrdb.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Division [maybe a bug]
jo opp wrote: 2008/5/11 Chris W [EMAIL PROTECTED]: jo opp wrote: Hello! $var1= 2155243640%31104000; $var2= 2147309244%31104000; echo $var1 // Return -24651656 echo $var2 // Return 1133244 $var2 return the correct result, but $var1 is wrong (the correct result is 9067640) Probably because the maximum signed 32 bit integer value is 2,147,483,648 OK, but with bigger numbers works fine again. Right now I made a function to deal with this issue: function remainder($dividend,$divisor){ $remainder= $dividend-(floor($dividend/$divisor)*$divisor); return $remainder; } What do you think about it? That will convert the numbers to floating point, which will give you round off error if the numbers get too big. -- Chris W KE5GIX Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm; Ham Radio Repeater Database. http://hrrdb.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Division [maybe a bug]
jo opp wrote: Hello! $var1= 2155243640%31104000; $var2= 2147309244%31104000; echo $var1 // Return -24651656 echo $var2 // Return 1133244 $var2 return the correct result, but $var1 is wrong (the correct result is 9067640) Probably because the maximum signed 32 bit integer value is 2,147,483,648 if you are dealing with numbers that large, consider using some arbitrary precision math functions that can work with as large of numbers as you need. http://us3.php.net/manual/en/refs.mathcrypto.math.php -- Chris W KE5GIX Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm; Ham Radio Repeater Database. http://hrrdb.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is this a bug?!!! I cna't believe! Sorry, if im wrong...
Well, unless I'm misstaken, the '= new' should only be used once with every class, so your code doesn't really make sense. The reason is that you are trying to set the A to the new a, not $a to the new a.. Now, A couldn't get changed I suppose, so therefore, $arr[1] will be a reference to $a, which is still a reference to A.. Something like that.. I can only guess it'll work as expected ((wsx)(wsx)) if you change =new to =new.. -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com News.Php.Net [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] ? class A { var $name; function A($str) { $this-name = $str; } } $arr = array(); //Put to array to objects of class A, // where their attribute A::a is assigned a different value //objects are assigned to an array by reference $a = new A(qaz); $arr[0] = $a; $a = new A(wsx); $arr[1] = $a; //But watch the output!!! // It is (qaz)(qaz), which means that the attribute of a first // object assigned to array is outputted!!! WHY?!?!!! foreach($arr as $a) { echo (.$a-name.); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Possible Leap Year bug with strtotime (4.3.4)?
Rob Petty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | I am getting incorrect results from strtotime: | | [dali]$ uname -a | Linux dali 2.4.24-grsec+w+fhs5+gr1913+nfs+++p3+c3+bu+gr0b-v6.182 #1 SMP Mon Jan 5 12:43:44 PST 2004 i686 unknown | [dali]$ date | Sat Feb 28 14:33:39 PST 2004 | [dali]$ cat t1.php | ? | $start = strtotime('next monday'); | echo ('Start timestamp: '.$start.'br'.\n); | echo ('Next Monday: '.date('l, M d Y',$start).'br'.\n); | $first = strtotime('first Monday',$start); | echo ('First Monday: '.date('l, M d Y',$first).'br'.\n); | $oneth = strtotime('1 Monday',$start); | echo ('1 Monday: '.date('l, M d Y',$oneth).'br'.\n); | $next = strtotime('next Monday',$start); | echo ('Next Monday: '.date('l, M d Y',$next).'br'.\n); | $twoth = strtotime('2 Monday',$start); | echo ('2 Monday: '.date('l, M d Y',$twoth).'br'.\n); | $third = strtotime('third Monday',$start); | echo ('Third Monday: '.date('l, M d Y',$third).'br'.\n); | $threeth = strtotime('3 Monday',$start); | echo ('3 Monday: '.date('l, M d Y',$threeth).'br'.\n); | ? | [dali]$ php t1.php | Content-type: text/html | X-Powered-By: PHP/4.3.4 | | Start timestamp: 1078732800br | Next Monday: Monday, Mar 08 2004br | First Monday: Monday, Mar 08 2004br | 1 Monday: Monday, Mar 08 2004br | Next Monday: Monday, Mar 15 2004br | 2 Monday: Monday, Mar 15 2004br | Third Monday: Monday, Mar 22 2004br | 3 Monday: Monday, Mar 22 2004br | [dali]$ | | | next monday should be Mar 01 2004 instead of Mar 08 2004. Any ideas? But, the exact same code run from my system returns correct results: [EMAIL PROTECTED] tmp]# uname -a Linux helios 2.4.20-28.7smp #1 SMP Thu Dec 18 11:18:31 EST 2003 i686 unknown [EMAIL PROTECTED] tmp]# date Sat Feb 28 13:34:08 MST 2004 [EMAIL PROTECTED] tmp]# php /tmp/t1.php X-Powered-By: PHP/4.1.2 Content-type: text/html Start timestamp: 1078124400br Next Monday: Monday, Mar 01 2004br First Monday: Monday, Mar 01 2004br 1 Monday: Monday, Mar 01 2004br Next Monday: Monday, Mar 01 2004br 2 Monday: Monday, Mar 08 2004br Third Monday: Monday, Mar 15 2004br 3 Monday: Monday, Mar 15 2004br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: IS THIS A BUG?
DvDmanDT wrote: When using register_globals=off, this might be off intrest: (notice $$var) while(list($var,$val)=each($_REQUEST))$$var=$val; Why not just turn register_globals on, then? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: IS THIS A BUG?
This functionality is a feature and is commonly called variable variables. http://www.php.net/variables.variable Cheers, Rob. On Wed, 2003-08-27 at 16:42, DvDmanDT wrote: Considering the manual has examples using that method (or at least had), and many tutorials, I think you can use it... When using register_globals=off, this might be off intrest: (notice $$var) while(list($var,$val)=each($_REQUEST))$$var=$val; -- // DvDmanDT MSN: [EMAIL PROTECTED] Mail: [EMAIL PROTECTED] Steve Todd [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Is it possible to define a variable, such as: $foo = bar; and then do as follows to create a totally different variable: $$foo = text here; this seems to mean $bar = text here;. Is this a bug or can we legally use it. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .-. | Worlds of Carnage - http://www.wocmud.org | :-: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul.| `-' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: IS THIS A BUG?
* Thus wrote DvDmanDT ([EMAIL PROTECTED]): Considering the manual has examples using that method (or at least had), and many tutorials, I think you can use it... When using register_globals=off, this might be off intrest: (notice $$var) while(list($var,$val)=each($_REQUEST))$$var=$val; Actually there is a funtion for that, php=4.1.0: http://php.net/import_request_variables Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: IS THIS A BUG?
I also wanna add that it works for functions as well: $foo=bar; $foo(); would call the function bar()... I read this in the manual at some point like a year ago... This isn't something I would recommend using as you could in 90% of the cases screw it all badly... Could be useful sometimes though (I got an example, but I'm a bit lazy...) -- // DvDmanDT MSN: [EMAIL PROTECTED] Mail: [EMAIL PROTECTED] Steve Todd [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Is it possible to define a variable, such as: $foo = bar; and then do as follows to create a totally different variable: $$foo = text here; this seems to mean $bar = text here;. Is this a bug or can we legally use it. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: IS THIS A BUG?
* Thus wrote Leif K-Brooks ([EMAIL PROTECTED]): DvDmanDT wrote: When using register_globals=off, this might be off intrest: (notice $$var) while(list($var,$val)=each($_REQUEST))$$var=$val; Why not just turn register_globals on, then? There are several reasons why not to turn globals on. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: IS THIS A BUG?
On Wed, 27 Aug 2003 18:36:26 -0400, you wrote: DvDmanDT wrote: When using register_globals=off, this might be off intrest: (notice $$var) while(list($var,$val)=each($_REQUEST))$$var=$val; Why not just turn register_globals on, then? I assume you could use it to only pull in variables from POST or GET, or you could add some complexity to the loop and verify the variables as they come in. (Personally, I agree - just turn the damn switch back on. It's always the first thing I do to an install.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: IS THIS A BUG?
And also for class names $foo = bar; $blah = new $foo(); $blah would be a new instance of the class bar I've actually used the above, but it was a special case.. I wouldn't normally use it. -Original Message- From: DvDmanDT [mailto:[EMAIL PROTECTED] Sent: Thursday, 28 August 2003 8:58 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: IS THIS A BUG? I also wanna add that it works for functions as well: $foo=bar; $foo(); would call the function bar()... I read this in the manual at some point like a year ago... This isn't something I would recommend using as you could in 90% of the cases screw it all badly... Could be useful sometimes though (I got an example, but I'm a bit lazy...) -- // DvDmanDT MSN: [EMAIL PROTECTED] Mail: [EMAIL PROTECTED] Steve Todd [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Is it possible to define a variable, such as: $foo = bar; and then do as follows to create a totally different variable: $$foo = text here; this seems to mean $bar = text here;. Is this a bug or can we legally use it. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Information from NOD32 1.490 (20030820) __ This message was checked by NOD32 for Exchange e-mail monitor. http://www.nod32.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: IS THIS A BUG?
Considering the manual has examples using that method (or at least had), and many tutorials, I think you can use it... When using register_globals=off, this might be off intrest: (notice $$var) while(list($var,$val)=each($_REQUEST))$$var=$val; -- // DvDmanDT MSN: [EMAIL PROTECTED] Mail: [EMAIL PROTECTED] Steve Todd [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Is it possible to define a variable, such as: $foo = bar; and then do as follows to create a totally different variable: $$foo = text here; this seems to mean $bar = text here;. Is this a bug or can we legally use it. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Possible PHP/MySQL Bug?
On Sat, 1 Feb 2003 13:28:00 -0800 [EMAIL PROTECTED] (Tim Lan) wrote: The following code is supposed to migrate data from an old database to a new one, but produces the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17 The code: [...] Any idea? Yeah, read out mysql_error() after sending the query and before doing fetch... to see what mysql thinks is wrong. Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Possible PHP/MySQL Bug?
and by the way, the query on line 16 (the problematic one) works fine when run directly in MySQL. Tim Tim Lan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The following code is supposed to migrate data from an old database to a new one, but produces the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17 The code: ?php /* connect to database */ if(!($srcDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('temp', $srcDB)) { echo 'Unable to connect to source database'; exit; } if(!($desDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('cgu', $desDB)) { echo 'Unable to connect to destination database'; exit; } /* table 'user' */ mysql_query(TRUNCATE TABLE user); $result = mysql_query(SELECT name, username, password, email, aim, phone, FROM_UNIXTIME(active) FROM user LIMIT 10, $srcDB); while(list($name, $username, $password, $email, $aim, $phone, $active) = mysql_fetch_array($result)) { $fname = substr($name, 0, strrpos($name, ' ')); $lname = substr($name, strrpos($name, ' ')); $password = mysql_result(mysql_query(SELECT DECODE(password, '$username') AS pwd FROM user WHERE username = '$username', $srcDB), 0, 'pwd'); $signup = mysql_query(SELECT MIN(date) AS signup FROM entry WHERE seller = '$username' OR buyer = '$username', $srcDB); if(mysql_num_rows($signup) == 0) $signup = $active; else $signup = mysql_result($signup, 0, 'signup'); $sql = INSERT INTO user (fname, lname, username, password, email, aim, phone, signup, lastActivity) VALUES ('$fname', '$lname', '$username', '$password', '$email', '$aim', '$phone', '$signup', '$active'); echo 'pcode'.str_replace(array((', ', ',, ')), array(('b, 'b', /b',, '/b)), $sql).'/code/p'; mysql_query($sql, $desDB); } ? Any idea? Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Possible PHP/MySQL Bug?
On Sat, 1 Feb 2003 13:28:00 -0800 [EMAIL PROTECTED] (Tim Lan) wrote: The following code is supposed to migrate data from an old database to a new one, but produces the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17 The code: ?php /* connect to database */ if(!($srcDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('temp', $srcDB)) { echo 'Unable to connect to source database'; exit; } if(!($desDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('cgu', $desDB)) { echo 'Unable to connect to destination database'; exit; } ah yes and another thing. you can't work on two databases with the same connection parameters (host, username,password) to have different connection-ids. PHP only keeps one connection and not two with the same parameters. They are the same connection for php which is expected behaviour there (although I don't like it too). Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Possible PHP/MySQL Bug?
Thomas, I changed it so that the two connections use different username/password combination, and everything went smoothly. Thank you very much for your rapid response. Tim Thomas Seifert [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Sat, 1 Feb 2003 13:28:00 -0800 [EMAIL PROTECTED] (Tim Lan) wrote: The following code is supposed to migrate data from an old database to a new one, but produces the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17 The code: ?php /* connect to database */ if(!($srcDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('temp', $srcDB)) { echo 'Unable to connect to source database'; exit; } if(!($desDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('cgu', $desDB)) { echo 'Unable to connect to destination database'; exit; } ah yes and another thing. you can't work on two databases with the same connection parameters (host, username,password) to have different connection-ids. PHP only keeps one connection and not two with the same parameters. They are the same connection for php which is expected behaviour there (although I don't like it too). Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
@mysql_select_db(be); // this doesn't fail, because only the second (UPDATE) query fails. The first query (SELECT) is done! - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Nuno Lopes [EMAIL PROTECTED] Cc: MySQL List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 5:06 PM Subject: Re: [PHP] Re: PHP and MySQL bug @mysql_select_db(be); -- this failed do echo mysql_error(); to see what went wrong Nuno Lopes wrote: I done a echo of Mysql_error and it returned: 'Nenhum banco de dados foi selecionado' (I have the mysql server in portuguese, but the translation is something like 'no db was selected') - Original Message - From: David Freeman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 10:29 PM Subject: RE: [PHP] Re: PHP and MySQL bug @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work Personally, I'd call it bad programming practice to do a database update and not check to see if it worked or not. In this case, how are you determining that the query did not work? Are you manually checking the database? You don't have anything in your code to check the status of this query. Perhaps this might get you somewhere: $qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id'); if (isset($qid) mysql_affected_rows() == 1) { echo query executed; } else { echo query failed: . mysql_error(); } At least this way you might get some indication of where the problem is. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
Doesn't you have any simpler answer?? Maybe installing the new version of mysql server - I have version 3.23.49 - should do the trick - Original Message - From: Larry Brown [EMAIL PROTECTED] To: Nuno Lopes [EMAIL PROTECTED]; MySQL List [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 4:12 PM Subject: RE: [PHP] Re: PHP and MySQL bug Since nobody is jumping in to say it is some simple configuration/setting personally my next step would be to shut down all services on the box that aren't absolutely necessary and stop everything in the registry under run and stop anything in the start folder of the start menu and run the same tests. If no positive results I would uninstall php completely and clean any reference in the registry of it and then install with everything still shut down. Retest, if no progress do the same with mysql. These are radical and time-consuming methods, but it seems as though it is broken. If you absolutely need this fixed fast you might resort to paying the developers to give you a solution, although it may end up being what I just listed, or it could be some simple fix that we aren't aware of. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 4:31 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Re: PHP and MySQL bug I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and mysql 3.23.49. Everything is working fine, except this. With pconnect the error is the same! - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Monday, January 06, 2003 6:28 PM Subject: RE: [PHP] Re: PHP and MySQL bug This definitely sounds like a buggy installation or there may be some problem with the communication between the web server and the mysqld. Is the db on a different machine? Try using mysql_pconnect instead of connect just to see what result you get. I have read some unfavorable statements about using pconnect with a large number of hits so if it works you should read the comments about it on php.net. Do a search for mysql_pconnect. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 1:09 PM To: MySQL List; [EMAIL PROTECTED] Subject: [PHP] Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and mysql 3.23.49. Everything is working fine, except this. With pconnect the error is the same! - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Monday, January 06, 2003 6:28 PM Subject: RE: [PHP] Re: PHP and MySQL bug This definitely sounds like a buggy installation or there may be some problem with the communication between the web server and the mysqld. Is the db on a different machine? Try using mysql_pconnect instead of connect just to see what result you get. I have read some unfavorable statements about using pconnect with a large number of hits so if it works you should read the comments about it on php.net. Do a search for mysql_pconnect. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 1:09 PM To: MySQL List; [EMAIL PROTECTED] Subject: [PHP] Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
@mysql_select_db(be); -- this failed do echo mysql_error(); to see what went wrong Nuno Lopes wrote: I done a echo of Mysql_error and it returned: 'Nenhum banco de dados foi selecionado' (I have the mysql server in portuguese, but the translation is something like 'no db was selected') - Original Message - From: David Freeman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 10:29 PM Subject: RE: [PHP] Re: PHP and MySQL bug @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work Personally, I'd call it bad programming practice to do a database update and not check to see if it worked or not. In this case, how are you determining that the query did not work? Are you manually checking the database? You don't have anything in your code to check the status of this query. Perhaps this might get you somewhere: $qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id'); if (isset($qid) mysql_affected_rows() == 1) { echo query executed; } else { echo query failed: . mysql_error(); } At least this way you might get some indication of where the problem is. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
I'm using Windows 2000. - Original Message - From: Cleber [EMAIL PROTECTED] To: Nuno Lopes [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 10:23 AM Subject: Re: [PHP] Re: PHP and MySQL bug Try add to /etc/hosts the name and ip of DB is located - Original Message - From: Nuno Lopes [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 7:31 AM Subject: Re: [PHP] Re: PHP and MySQL bug I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and mysql 3.23.49. Everything is working fine, except this. With pconnect the error is the same! - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Monday, January 06, 2003 6:28 PM Subject: RE: [PHP] Re: PHP and MySQL bug This definitely sounds like a buggy installation or there may be some problem with the communication between the web server and the mysqld. Is the db on a different machine? Try using mysql_pconnect instead of connect just to see what result you get. I have read some unfavorable statements about using pconnect with a large number of hits so if it works you should read the comments about it on php.net. Do a search for mysql_pconnect. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 1:09 PM To: MySQL List; [EMAIL PROTECTED] Subject: [PHP] Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
I done a echo of Mysql_error and it returned: 'Nenhum banco de dados foi selecionado' (I have the mysql server in portuguese, but the translation is something like 'no db was selected') - Original Message - From: David Freeman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 10:29 PM Subject: RE: [PHP] Re: PHP and MySQL bug @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work Personally, I'd call it bad programming practice to do a database update and not check to see if it worked or not. In this case, how are you determining that the query did not work? Are you manually checking the database? You don't have anything in your code to check the status of this query. Perhaps this might get you somewhere: $qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id'); if (isset($qid) mysql_affected_rows() == 1) { echo query executed; } else { echo query failed: . mysql_error(); } At least this way you might get some indication of where the problem is. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and MySQL bug
The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and MySQL bug
It would be helpful if you posted that error. You can get it by changing the die to $queryr = mysql_query($query) or die(mysql_error()); Without knowing the error, you problem will be harder for everyone to debug. -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 10:09 AM To: MySQL List; [EMAIL PROTECTED] Subject: Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and MySQL bug
Here is the source code: ? @MYSQL_CONNECT(localhost, nlopes, testing) or die(Erro 1); @mysql_select_db(be); $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); if (mysql_num_rows($r)==0) { die (Erro); } else { $re=mysql_fetch_array($r, MYSQL_NUM); $nome=$re[0]; $url=$re[1]; $mirrors=$re[2]; $h=$re[3]; $h++; @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work echo h2Seleccione a localização para o download:/h2pa href=\$url\Localização Principal/a/p; if ($mirrors) { echo pnbsp;/ph2Mirrors/h2p; $m=explode(»,$mirrors); foreach ($m as $v) { $m2=explode(!,$v); echo a href=\$m2[1]\$m2[0]/abr; } echo /ppNota: Deve escolher o mirror mais próximo da sua localização, para acelerar o dowload. No caso de um mirror estar indisponível, utilize outro./p; } } @MYSQL_CLOSE(); ?/body/html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: undocumented OOP feature/bug?
You could check if a variable in $this exists: class A { var $bla; function Go() { switch(isset($this-bla)) { case true: echo 'Called Dynamicalybr /'; break; case true: echo 'Called Staticallybr /'; break; } } } Or, if that doesn't work, you could do this: class A { var $dynamic = true; function Go() { switch(isset($this-bla) $this-bla == true) { case true: echo 'Called Dynamicalybr /'; break; case true: echo 'Called Staticallybr /'; break; } } } Or: class A { var $dynamic; function A() { $this-dynamic = true; } function Go() { switch(isset($this-bla) $this-bla == true) { case true: echo 'Called Dynamicalybr /'; break; case true: echo 'Called Staticallybr /'; break; } } } Just some things you could try. Sean Malloy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Consider the following code... class A { function Go() { switch (isset($this)) { case true: echo 'Called Dynamicallybr /'; break; case false: echo 'Called Staticallybr /'; break; } } } class B { function Go() { A::Go(); } } A::Go(); $a = new A(); $a-Go(); B::Go(); $b = new B(); $b-Go(); My understanding is that the output should be: Called Statically Called Dynamically Called Statically Called Statically Yet the output is actually: Called Statically Called Dynamically Called Statically Called Dynamically Now my question is, is this what was intended? It seems that if you call a static class from within a dynamic instance of a class, the static class then decides $this should reference the class from which the static class was called Anyone else come across this? It could be useful, but right now, its bloody annoying! I need a class to be called from within another clas, and it needs to know wether it has had an instance created, or wether it is being statically called, and now I'll have to write some kludge code instead... /// // Sean Malloy // Developer // element // t: +61 3 9510 // f: +61 3 9510 7755 // m: 0413 383 683 /// DISCLAIMER: © copyright protected element digital pty ltd 2002. the information contained herein is the intellectual property of element digital pty ltd and may contain confidential material. you must not disclose, reproduce, copy, or use this information in any way unless authorised by element digital pty ltd in writing or except as permitted by any applicable laws including the copyright act 1968 (cth). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP and MySQL bug
@MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work Personally, I'd call it bad programming practice to do a database update and not check to see if it worked or not. In this case, how are you determining that the query did not work? Are you manually checking the database? You don't have anything in your code to check the status of this query. Perhaps this might get you somewhere: $qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id'); if (isset($qid) mysql_affected_rows() == 1) { echo query executed; } else { echo query failed: . mysql_error(); } At least this way you might get some indication of where the problem is. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: undocumented OOP feature/bug?
Use get_class($this) function Go() { if (!isset($this)) { echo 'Called Staticallybr /'; } switch(get_class($this)) { // note get_class is lowercase (which I think is a bug, but it hasn't changed, so oh well) 'a' : echo 'Called Dynamicallybr /'; 'b' : echo 'Called Staticallybr /'; } } or, is_a() to include descendants (PHP 4.2.0+ I think) function Go() { if (!isset($this)) { echo 'Called Staticallybr /'; } if (is_a($this,'a')) { echo 'Called Dynamicallybr /'; } else { echo 'Called Staticallybr /'; } } Incidentally, this ability to call other methods and operate on your own variables is in my opinion the greatest feature of PHP along with aggregation. It allows dynamic (runtime!) multiple inheritance, which is essential for the new version of a complex data-access project I'm working on constantly (http://calendar.chiaraquartet.net) Take care, Greg -- phpDocumentor http://www.phpdoc.org Sean Malloy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Consider the following code... class A { function Go() { switch (isset($this)) { case true: echo 'Called Dynamicallybr /'; break; case false: echo 'Called Staticallybr /'; break; } } } class B { function Go() { A::Go(); } } A::Go(); $a = new A(); $a-Go(); B::Go(); $b = new B(); $b-Go(); My understanding is that the output should be: Called Statically Called Dynamically Called Statically Called Statically Yet the output is actually: Called Statically Called Dynamically Called Statically Called Dynamically Now my question is, is this what was intended? It seems that if you call a static class from within a dynamic instance of a class, the static class then decides $this should reference the class from which the static class was called Anyone else come across this? It could be useful, but right now, its bloody annoying! I need a class to be called from within another clas, and it needs to know wether it has had an instance created, or wether it is being statically called, and now I'll have to write some kludge code instead... /// // Sean Malloy // Developer // element // t: +61 3 9510 // f: +61 3 9510 7755 // m: 0413 383 683 /// DISCLAIMER: © copyright protected element digital pty ltd 2002. the information contained herein is the intellectual property of element digital pty ltd and may contain confidential material. you must not disclose, reproduce, copy, or use this information in any way unless authorised by element digital pty ltd in writing or except as permitted by any applicable laws including the copyright act 1968 (cth). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and MySQL bug
You really should be using a $link variable...it's good habit: $link = mysql_connect(...); mysql_select_db( mydb , $link); $query = mysql_query( select... , $link ); $result = mysql_fetch_array($query); Lewis Nuno Lopes [EMAIL PROTECTED] wrote in message 003a01c2b3de$95004650$0100a8c0@pc07653">news:003a01c2b3de$95004650$0100a8c0@pc07653... Dear Sirs, I'm using PHP and MySQL to make my programs. But I think I discovered a bug in PHP or in MySQL (I don't know!). In one of my files I have the following: MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work! But if I close the connection and open another te query is done:*/ MYSQL_CLOSE(); MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); --- I don't know why is this? Because I'm used to do more than a query per connection and this never happened! I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3. I hope you solve this, Nuno Lopes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
Personally I say get yourself a good simple dbconnect class and make life easy. Also if you ever change users, database name etc, you onlu have one place to replace it in your code. I wrote mine based on http://www.vtwebwizard.com/tutorials/mysql/ Take a look at it. Nice and simple. Mike *** REPLY SEPARATOR *** On 04/01/2003 at 1:09 PM OrangeHairedBoy wrote: You really should be using a $link variable...it's good habit: $link = mysql_connect(...); mysql_select_db( mydb , $link); $query = mysql_query( select... , $link ); $result = mysql_fetch_array($query); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
Personally I think the problem lies somewhere between the chair and the keyboard (Sorry, couldn't resist) :-) *** REPLY SEPARATOR *** On 04/01/2003 at 4:58 PM Stefan Hinz, iConnect (Berlin) wrote: It doesn't work because of the /* Some code including ... */ part ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and MySQL bug
Nuno, $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work!*/ It doesn't work because of the /* Some code including ... */ part ;-) First thing, I would check if $h and $id really are what you expect them to be, like: $sql = UPDATE d SET h='$h' WHERE id='$id'; echo $sql; MYSQL_QUERY($sql); If this part is okay, then the problem lies within this myterious /* Some code */. Regards, -- Stefan Hinz [EMAIL PROTECTED] Geschäftsführer / CEO iConnect GmbH http://iConnect.de Heesestr. 6, 12169 Berlin (Germany) Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 - Original Message - From: Nuno Lopes [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, January 04, 2003 11:46 AM Subject: PHP and MySQL bug Dear Sirs, I'm using PHP and MySQL to make my programs. But I think I discovered a bug in PHP or in MySQL (I don't know!). In one of my files I have the following: MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work! But if I close the connection and open another te query is done:*/ MYSQL_CLOSE(); MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); --- I don't know why is this? Because I'm used to do more than a query per connection and this never happened! I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3. I hope you solve this, Nuno Lopes - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is this a BUG?
In article 000c01c21b02$4b69e1b0$1aed0dd1@gateway, [EMAIL PROTECTED] (César aracena) wrote: I have a mainusers.php page, which only calls for functions instead of writing them all together inside that page. At one step, it calls for an adduser function which brings a table that let the administrator insert a new user. After the submit button is pressed, it calls for a function called useradded which resides in the same library as the adduser function. This useradded function queries the database, inserting the user. The problem is that it does not get the HTTP POST VARS although they are being passed according to phpinfo.php. Without an example to look at, I may be mis-understanding your situation. But it sounds like this may be a scoping issue: trying to use a global ($HTTP_POST_VARS) within a function without using the special global keyword. This won't work: function adduser() { echo LOCAL SCOPE: . $HTTP_POST_VARS['user']; } adduser(); This will: function adduser() { global $HTTP_POST_VARS['user']; echo GLOBAL SCOPE: . $HTTP_POST_VARS['user']; } adduser(); If this is the problem you're having, you can find more information at: http://php.net/variables.scope http://php.net/global -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: the ?PHPSESSID=spoofme 'bug'
I myself wrote: Can I tell you more than what the subject says? proceeding: Close the browser, clean all your cookies, and open any page with that ?PHPSESSID=spoofme appended. And see what happens. 1) No cookies are left 2) a session 'spoofme' is created Do you need more? Javascript url injection ad cross site scripting become obsolete with this 'feature'. PLS! I mean, as the zend site doesn't quite work like this (do the same test proceeding as described above...) Their session to append to your cookie-enabled browser location are Zend_Session_DB=whatever and Zend_Session_DB_SECURE=whatever2 on their login page. I don't know if this is related to the free downloadable version, and the one they sell and adopt is more 'fortified'... they should clearly state it then! Gian I've commited the latest PHPLIB version (php-lib-stable) that humbly tries to prevent this unsecure behaviour, as I said in one of my prev messages. I can't extend it to the so-called PHPLIB4 (that uses native PHP4 session) tree, because PHP is truely holed in that. Gian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: the ?PHPSESSID=spoofme 'bug'
Giancarlo Pinerolo wrote: I myself wrote: Can I tell you more than what the subject says? proceeding: Close the browser, clean all your cookies, and open any page with that ?PHPSESSID=spoofme appended. And see what happens. spoofme is not the exact term. ?PHPSESSID=hijackme should be more appropriate, but I avoided it for well known 'historical' reasons :-| G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: the ?PHPSESSID=spoofme 'bug'
If you destroy the session (for exaple with a logoff button) this dosen work. Josep R. Raurell Giancarlo Pinerolo wrote: Giancarlo Pinerolo wrote: I myself wrote: Can I tell you more than what the subject says? proceeding: Close the browser, clean all your cookies, and open any page with that ?PHPSESSID=spoofme appended. And see what happens. spoofme is not the exact term. ?PHPSESSID=hijackme should be more appropriate, but I avoided it for well known 'historical' reasons :-| G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php, win32, xml bug?
J Wynia [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The first thing I'd do is run your transformation through one of (or all of) the rest of the XSL engines out there. There's a lot more variability out there in XSL engines. Unfortunately, Sablotron isn't the most conformant of the field. I haven't used Sablotron in a while for XSLT processing so am not sure of your specific question. I left Sablotron behind for reasons like this one. It fails on a great many transformations that run through Xalan, Saxon and MSXML identically with no errors. My general rule is if it blows up all XSLT engines, it's probably my XSLT. If Sablotron's the only one that chokes, it's Sablotron. The new API for XSLT should allow for the other engines, however, I haven't seen anything on putting the rest of them into the equation, yet. i tested it on MSXSL, no problem, all runs fine. but how to choose another xsl-engine? thanks alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php, win32, xml bug?
If you happen to be running PHP on Windows, you can use the MSXML engine through it's COM interface. Unfortunately, I haven't seen any documentation on plugging any of the other engines into the new (for PHP4.1) XSLT API. So, I don't know of a solution on UNIX (most of my XSLT work is in a Websphere on Win2K environment). Here's the basic COM code for Windows servers: $xml_com = new COM(MSXML.DOMDocument) or die(MSXML must be installed on server.); $xsl_com = new COM(MSXML.DOMDocument) or die(MSXML must be installed on server.); $xml_com - loadXML($xml_string); $xsl_com - loadXML($xsl_string); $output = $xml_com - transformNode($xsl_com); Alexander GräF [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... J Wynia [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The first thing I'd do is run your transformation through one of (or all of) the rest of the XSL engines out there. There's a lot more variability out there in XSL engines. Unfortunately, Sablotron isn't the most conformant of the field. I haven't used Sablotron in a while for XSLT processing so am not sure of your specific question. I left Sablotron behind for reasons like this one. It fails on a great many transformations that run through Xalan, Saxon and MSXML identically with no errors. My general rule is if it blows up all XSLT engines, it's probably my XSLT. If Sablotron's the only one that chokes, it's Sablotron. The new API for XSLT should allow for the other engines, however, I haven't seen anything on putting the rest of them into the equation, yet. i tested it on MSXSL, no problem, all runs fine. but how to choose another xsl-engine? thanks alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php, win32, xml bug?
The first thing I'd do is run your transformation through one of (or all of) the rest of the XSL engines out there. There's a lot more variability out there in XSL engines. Unfortunately, Sablotron isn't the most conformant of the field. I haven't used Sablotron in a while for XSLT processing so am not sure of your specific question. I left Sablotron behind for reasons like this one. It fails on a great many transformations that run through Xalan, Saxon and MSXML identically with no errors. My general rule is if it blows up all XSLT engines, it's probably my XSLT. If Sablotron's the only one that chokes, it's Sablotron. The new API for XSLT should allow for the other engines, however, I haven't seen anything on putting the rest of them into the equation, yet. Alexander GräF [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi, when im using xsl:output encoding=ISO-8859-1 i get Sablotron error on line 1: unknown encoding 'ISO-8859-1' in on line ... but i think iso-8859-1, utf-8, etc. support must be build in. in addition, when i try to include an external xsl with xsl:include href=... / or a xml file with document(), no matter what encoding the target-file has, i get the following error: Sablotron error on line 1: unknown encoding '' in on line ... yes, the position where the unknown encoding has to appear is empty, he says he does not know an unknown encoding ... how can i use the including functions, and how can i use iso-8859-1 as output encoding (the only workarround would be to convert the output encoding from utf-8 to iso-8859-1 with iconv, but this isnt the way i thought a xml-parser has to work ...) configuration: apache: Server Version: Apache/1.3.23 (Win32) PHP/4.1.1 DAV/1.0.3-dev Server Built: Jan 24 2002 20:30:48 server: Windows 2000 Server, SP2 2 GB RAM, dual-xeon 933 mhz php-info: System: Windows NT 5.0 build 2195 Build Date: Dec 30 2001 Thread Safety: enabled ZEND_DEBUG: enabled Configuration File (php.ini) Path: C:\WINNT\php.ini Virtual Directory Support: enabled This program makes use of the Zend Scripting Language Engine: Zend Engine v1.1.1, Copyright (c) 1998-2001 Zend Technologies with Zend Optimizer v1.2.0, Copyright (c) 1998-2001, by Zend Technologies XSLT support: enabled iconv support: enabled XML Support: active XML Namespace Support: active EXPAT Version: 1.95.2 ;Windows Extensions ;Note that MySQL and ODBC support is now built in, so no dll is needed for it. ; ;extension=php_bz2.dll ;extension=php_ctype.dll extension=php_cpdf.dll extension=php_curl.dll ;extension=php_cybercash.dll ;extension=php_db.dll ;extension=php_dba.dll ;extension=php_dbase.dll ;extension=php_dbx.dll extension=php_domxml.dll ;extension=php_dotnet.dll ;extension=php_exif.dll ;extension=php_fbsql.dll ;extension=php_fdf.dll ;extension=php_filepro.dll ;extension=php_gd.dll ;extension=php_gettext.dll ;extension=php_hyperwave.dll extension=php_iconv.dll ;extension=php_ifx.dll ;extension=php_iisfunc.dll ;extension=php_imap.dll ;extension=php_ingres.dll ;extension=php_interbase.dll ;extension=php_java.dll ;extension=php_ldap.dll ;extension=php_mbstring.dll ;extension=php_mcrypt.dll extension=php_mhash.dll extension=php_ming.dll ;extension=php_mssql.dll ;extension=php_oci8.dll ;extension=php_openssl.dll ;extension=php_oracle.dll extension=php_pdf.dll ;extension=php_pgsql.dll ;extension=php_printer.dll ;extension=php_sablot.dll ;extension=php_shmop.dll ;extension=php_snmp.dll extension=php_sockets.dll ;extension=php_sybase_ct.dll extension=php_xslt.dll ;extension=php_yaz.dll extension=php_zlib.dll thanks in advance alex __ alexander gräf [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: possible safe mode bug with opendir() ?
Hi again, I believe it should disallow openning a directory in safe mode if the UID of the directory does not match the UID of the PHP script. That is exactly the behavior of fopen() in safe mode. Without that behavior, users are permitted to write a PHP script that lets them crawl around the webserver seeing things they have no rights to see. It happens on our system that there will never be any files owned by user A under a directory owned by user B. But even if there were, I think safe mode should disallow this type of filesystem reading. Do you think the fact that this file reading is permitted is a bug that should be reported? A. It works like user/group permission as you know. I don't know what you want to protect :) Do you mean a script with opendir() shouldn't allow openning any directory under open_basedir if UID does not match? You can protect file basis, why do you need other protection for directories under open_basedir? Do you have good reason for this? -- Yasuo Ohgaki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: possible safe mode bug with opendir() ?
[EMAIL PROTECTED] wrote: Hi again, I believe it should disallow openning a directory in safe mode if the UID of the directory does not match the UID of the PHP script. That is exactly the behavior of fopen() in safe mode. Without that behavior, users are permitted to write a PHP script that lets them crawl around the webserver seeing things they have no rights to see. Now I see what you want :) It happens on our system that there will never be any files owned by user A under a directory owned by user B. But even if there were, I think safe mode should disallow this type of filesystem reading. Under UNIX like systems, /tmp is world writable and everyone on the system can open dir/wirte/read files, but it's possible to secure files/directory under /tmp. I think you can apply the same. GID support also helps to allow opening files certain group. Is it not enough for your security needs? Do you think the fact that this file reading is permitted is a bug that should be reported? I think the feature that check dir UID/GID will be useful for some prople. How about submit a feature request (It's one of bug report types) BTW, you have opotion that disallow opendir at all, with disable_functions directive in php.ini -- Yasuo Ohgaki _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: possible safe mode bug with opendir() ?
Yasuo Ohgaki wrote: [EMAIL PROTECTED] wrote: It happens on our system that there will never be any files owned by user A under a directory owned by user B. But even if there were, I think safe mode should disallow this type of filesystem reading. Under UNIX like systems, /tmp is world writable and everyone on the system can open dir/wirte/read files, but it's possible to secure files/directory under /tmp. I think you can apply the same. GID support also helps to allow opening files certain group. Is it not enough for your security needs? BTW, if you get rid of read permission for a directory, directory listing is not possible under UNIX like systems. You can still read/write files with proper permission. (unlink/create files with proper permission also. You can get rid of write permission for directory, too.) Just in case, you didn't know about it :) php.ini entries like safe_mode_opendir_sid safe_mode_opendir_gid will help to improve security still. I just don't need this kind of feature, but others may need it. -- Yasuo Ohgaki _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: possible safe mode bug with opendir() ?
[EMAIL PROTECTED] wrote: When in safe mode shouldn't PHP check to see if the directory that is about to be opened with a opendir() function has the same UID as the PHP script itself, and fail if the UIDs do not match? From 4.1.0, optional GID check is available. Because in PHP 4.0.6 with safe_mode on, a PHP script owned by fred can open any directory owned by any other UID, so long as the directory is under the open_basedir. This does not seem right to me, as it allows a user in safe_mode to browse all the files on the entire webserver, looking for things he might be able to peek at with a web browser. Please advise whether this should be a bug report. Take a look at lastest implementation see if you still have issues. http://snaps.php.net/ -- Yasuo Ohgaki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: possible safe mode bug with opendir() ?
But where user fred can opendir() a directory owned by user mary (underneath the open_basedir), that action doesn't even pass a UID check if the UIDs are supposed to match in safe mode in order for the action to be allowed. How would an optional GID check help? A. When in safe mode shouldn't PHP check to see if the directory that is about to be opened with a opendir() function has the same UID as the PHP script itself, and fail if the UIDs do not match? From 4.1.0, optional GID check is available. Take a look at lastest implementation see if you still have issues. http://snaps.php.net/ -- Yasuo Ohgaki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: possible safe mode bug with opendir() ?
[EMAIL PROTECTED] wrote: But where user fred can opendir() a directory owned by user mary (underneath the open_basedir), that action doesn't even pass a UID check if the UIDs are supposed to match in safe mode in order for the action to be allowed. How would an optional GID check help? It may, it may not. It works like user/group permission as you know. I don't know what you want to protect :) Do you mean a script with opendir() shouldn't allow openning any directory under open_basedir if UID does not match? I think it should be allowed. It's perfectly valid to me. What if directory is owned by other user, but there is files owned by the user. Would you like to disallow to list directory? I guess not. You can protect file basis, why do you need other protection for directories under open_basedir? Do you have good reason for this? -- Yasuo Ohgaki When in safe mode shouldn't PHP check to see if the directory that is about to be opened with a opendir() function has the same UID as the PHP script itself, and fail if the UIDs do not match? From 4.1.0, optional GID check is available. Take a look at lastest implementation see if you still have issues. http://snaps.php.net/ -- Yasuo Ohgaki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Is this a bug?
I have this code, which is a cooked down code of something bigger. So don't ask what it's for. The problem is that I can't get this script working the way I like it at all. Maybe it's a bug. Maybe you have another suggestion? Somewhere in the middle section i have wrote test1 and test2 as a comment. If you activate test2 instead of test1, then you will have some output(not the expected output), else I just see a page saying:The page cannot be displayed. I think it's very strange, any ideas? Try inserting this into a file and try yourself. /Stig ? $side = 1; function grabkeys ($felt, $key, $side) { global $newarray; $stopkey = array (A,Z);//De key-navne som den ikke skal gemme. If (!in_array($key , $stopkey)) { if ($felt == $side) { $newarray[] = $key;}; }; }; Get rid of ; after } They are silly. You could probably make $stopkey 'static', since it never seems to change. function showkeys ($felt, $key) { global $newarray; echo count($newarray) . -count newarraybr; // echo pre . $newarray[0] . /pre-newarraybr; //test2 echo $newarray[0] . -newarraybr; //test1 }; $row = array (A=1,B=1,C=1,D=1,E=1,F=1,Z=1); array_walk ($row, 'grabkeys', $side); array_walk ($row, 'showkeys'); ? Hrm... I seem to be getting sensible output *EXCEPT* that $newarray[0] seems to take on 'A' through 'Z' as you walk through $row with 'showkeys'... Seems pretty broken to me... But I'm using 4.0.2-dev on this machine... Is this the output you are getting with a current release? http://bugs.php.net may be the place to go... -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]