Re: [PHP] Re: socket_write buffer problem

2007-01-22 Thread Stut

Richard Luckhurst wrote:

 I have been banging my head against a wall all day trying to work
 this problem out. To recap my earlier post, I have a simple socket
 listener that handles the incoming string fine with socket_read and
 then it fires off the application as it should. When it returns the
 data to the socket only the first 1024 bytes get sent.

 I have done some testing and for the life of me I can not find a way
 to loop through the buffer. Everything I try still results in only
 the first 1024 bytes.



 Does anyone have any clues?


You've already been given a clue... read the manual: 
http://php.net/socket_write


I know you said you read it, but you obviously haven't. To quote...

"Returns the number of bytes successfully written to the socket or 
*FALSE* on error"


You are not even checking the return value from socket_write for an 
error, nevermind to see the number of bytes actually sent. The 
socket_write function, like many other similar functions, is not 
guaranteed to send exactly what you give it, even if you provide the 
third parameter.


Your code for sending data should be structured something like the 
following *untested* code...


$len = strlen($datatosend);
$offset = strlen($datatosend);
while ($offset < $len)
{
   $sent = socket_write($client, substr($datatosend, $offset), $len - 
$offset);

   if ($sent === false)
   {
  // An error occurred, break out of the while loop
  break;
   }
   $offset += $sent;
}

if ($offset < $len)
{
   // An error occurred, use *socket_last_error()* 
* and 
**socket_strerror()* 
 to find out 
what happened

}
else
{
   // Data sent ok
}

Your problem is that you made lazy assumptions, and we all know that 
assumptions are the mother of all fsckups. Now please irradiate your 
hands and try again.


-Stut

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



Re: [PHP] Re: socket_write buffer problem

2007-01-22 Thread Jochem Maas
hi Richard,

Richard Luckhurst wrote:
> Hi List
> 



> Does anyone have any clues?

sorry to assume you hadden not read the manual, but it does seem your
not taking onboard the bit about the return value of socket_write().

please revise you code in the manner Stut suggested (checking/using the return
value of scket_write()) and come back if that doesn't work.

> 
> Regards,
> Richard Luckhurst  
> Product Development
> Exodus Systems - Sydney, Australia.
> 

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



Re: [PHP] Re: socket_write buffer problem

2007-01-22 Thread Stut
Please keep it on-list, even if you feel you need to have a go at me - 
they love it!


[EMAIL PROTECTED] wrote:

> You've already been given a clue... read the manual:
> http://php.net/socket_write
>
> I know you said you read it, but you obviously haven't. To quote...

 Now you are making an assumption and you are making a "fsckup". Just
 because I did not show in my simplified example that I had tested the
 number of bytses sent does not mean for a second that I had not done
 it.


I'm going by the information you have supplied. You cannot possibly 
expect us to help you if you do not provide the correct information.



 The number of bytes sent was 1024 for the first iteration of the loop
 and none for the second. The socket_write function returned a status
 of "SUCCESS".


Please show us the *actual* code you are using. Without that we don't 
have any real chance of finding the problem.



> Your problem is that you made lazy assumptions, and we all know
> that assumptions are the mother of all fsckups. Now please
> irradiate your hands and try again.

 I believe you are making an "lazy assumption" here as you have no
 idea what I have tried. While I appreciate help I believe your
 response was rude and not very helpful to a newbie to PHP.


I apologise if you took my response to be rude, that was not my intention.

As I said before, if you want help you need to give us accurate 
information. We're not mind readers.


-Stut

PS. Look into my eyes, just the eyes, not around the eyes, into my eyes. 
You're under. When you wake up you will realise that you were not 
offended by my post, you were just embarrassed because you failed the 
full disclosure test. 3..2..1.. and you're back.


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



Re: [PHP] Newbie - help with a foreach

2007-01-22 Thread Németh Zoltán
On v, 2007-01-21 at 01:28 -0800, pub wrote:
> On Jan 18, 2007, at 2:43 AM, Németh Zoltán wrote:
> 
> > first, do you want to allow several jobs for the same company to be
> > 
> > stored in the DB and appear on the page, right? (if not, then why
> > are
> > 
> > you storing them in separate tables?)
> > 
> > 
> Yes, I have the name of the company with address etc in the "client"
> table
> and all the jobs in the "job" table, so that I can display several
> jobs per client 
> > second, you should do it with one query I think
> > 
> > 
> > something like "SELECT t1.*, t2.* FROM client t1, job t2 WHERE
> > 
> > t1.companyId=t2.companyId ORDER BY t1.companyId"
> > 
> > 
> > and then you can do all stuff in one loop
> > 
> > 
> >  while ($aaa = mysql_fetch_array($result))
> > 
> > 
> > and you don't need that foreach stuff at all (which also seems to be
> > 
> > screwed up...)
> > 
> 
> I am working on my query as you suggested. I have a joint query that
> seems to work except that I get the name of the company twice. Could
> you please help me figure out how to make it echo the company once and
> list all the jobs next to it on the same line and start a new line
> with the next company?
> 
> 

ehh, I thought you want the jobs on separate lines, sorry.

this can be achieved for example like this:

$prev_cname = "";
while ($aaa = mysql_fetch_array($result,MYSQL_ASSOC))
 {  
  if ($aaa['companyName'] != $prev_cname) {
   echo "{$aaa['companyName']}";
  }
  echo "  > {$aaa['jobType']}";
  if ($aaa['companyName'] != $prev_cname) {
   echo "\n";
   $prev_cname = $aaa['companyName'];
  }
} 

hope that helps
Zoltán Németh


>   Here is the code I have now:
> 
> 
> $query = "SELECT client.companyName, job.jobType, job.pix, job.info,
> job.url
>  FROM client, job
>  WHERE client.companyId=job.companyId
>  AND client.view='yes'
>  order by client.companyName";
> 
> 
> 
> $result = mysql_query($query)  
> or die ("Couldn't execute query");
> 
>while  ($aaa = mysql_fetch_array($result,MYSQL_ASSOC))
>{  
>echo "{$aaa['companyName']} class='navArrow'>  >  href='single_page_t10.php?art=".$aaa['pix']."'>{$aaa['jobType']}\n";
> } 
> 

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



Re: [PHP] Re: socket_write buffer problem

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 11:33:51 +:
> [EMAIL PROTECTED] wrote:
> >> You've already been given a clue... read the manual:
> >> http://php.net/socket_write
> >>
> >> I know you said you read it, but you obviously haven't. To quote...
> >
> > Now you are making an assumption and you are making a "fsckup". Just
> > because I did not show in my simplified example that I had tested the
> > number of bytses sent does not mean for a second that I had not done
> > it.

Richard,

I had almost sent a message very similar to the one from Stut you're
complaining about here, but cancelled it because I expected you would
react the way you have, and I'd just waste energy.

One last try so that you know Stut is not alone in his assessment:

You might have actually played with a "simplified example", but judging
from your previous questions (and reactions to replies), you don't pay
much attention to your own observations, and/or you make too many
assumptions, and your subsequent fuckups bring you here.

You come claiming it's broken, you've tried everything, and show us code
that's simply broken.  We never see the correct code you claim to have
tried (after you've been told to fix bugs in what you have shown).

Programming is not like waving a magic wand, it's not our fault the
computer does what you tell it instead of what you want it to do!

Until-you-pull-your-head-from-wherever-it-is'ly yours,
...

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] Function returning but continues execution

2007-01-22 Thread David Mytton

Hi,

I have come across what appears to be a bug in PHP, but one that I am 
having difficulty writing test code for. Also, the bug only happens on a 
Linux build of PHP - the code is working as expected on Windows. This is 
on both PHP 5.2.0 and the very latest snapshots:


Windows: 5.2.1RC4-dev Jan 19 2007 16:16:57
Linux: PHP Version 5.2.1RC4-dev Jan 22 2007 11:54:28 
(php5.2-200701221130.tar.gz)


The configure line is:

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-curl' 
'--with-freetype-dir=/usr' '--with-gd' '--with-gettext' 
'--with-jpeg-dir=/usr' '--with-mysql' '--with-openssl' 
'--with-pdo-mysql' '--with-pear' '--with-png-dir=/usr' '--with-zlib' 
'--enable-calendar' '--enable-exif' '--enable-gd-native-ttf' 
'--enable-pdo' '--enable-soap' '--enable-sockets'


and no 3rd party extensions are enabled.

The code that is causing the problem exists within a class in a function 
called approve_friend. This is called by a "public" page with a 
parameter provided in GET being passed to the function approve_friend:


$username = filter_input(INPUT_GET, 'username', FILTER_SANITIZE_STRING);
if (!empty($username))
{
  if ($username != $_SESSION['user']['username'])
  { 
if ($core->user->add_friend($username))
{
  echo 1;
}
else
{
  echo 2;
}
  }
}

There is code in place of echo 1 and echo 2 but it's not relevant. Here, 
the code checks to make sure the username submitted is the not the same 
as the currently logged in use. If not, it will execute the 
$core->user->add_friend function.


add_friend runs through as follows:

1. Makes a call to $this->get_user where it gets data for the username 
$username provided when calling the function. It returns an array.


$friend = $this->get_user(1, NULL, $username);

2. Grabs some data from the session about the currently logged in user

$user['name'] = filter_var($_SESSION['user']['name'], 
FILTER_SANITIZE_STRING);
$user['user_id'] = filter_var($_SESSION['user']['user_id'], 
FILTER_SANITIZE_NUMBER_INT);
$user['username'] = filter_var($_SESSION['user']['username'], 
FILTER_SANITIZE_STRING);
$user['friend_count'] = filter_var($_SESSION['user']['friend_count'], 
FILTER_SANITIZE_NUMBER_INT);


3. Checks to make sure $friend has a value

if (empty($friend))
{
  return false;
}

4. Checks to make sure that the friend being added is not already added.

if (!empty($_SESSION['user']['friends']))
{
  if (in_array($friend['user_id'], $_SESSION['user']['friends']))
  {
return false;
  }
}

This is the point at which there is a problem. If I add this code before #4:

print_r($_SESSION['user']['friends']);
echo $friend['user_id']; exit;

Then I get the following output:

Array ( [0] => 3 ) 3

i.e. $_SESSION['user']['friends'] is an array with the key 0 and the 
value 3 and $friend['user_id'] has a value of 3. Therefore, the 
in_array() check above will return true and the function will return 
false. No further code in the function should execute. This is what 
happens on Windows - 2 is output to the page because the add_friend 
function has returned false.


Now, after #4, there is more code. This code is only supposed to execute 
if the friend doesn't already exist - it adds the friend, increments the 
friend count and sends an e-mail.


// Insert into friends
$core->database->exec('INSERT INTO users_friends SET user_id = 
"'.$user['user_id'].'", user_friend_id = "'.$friend['user_id'].'", 
status = 1');
$core->database->exec('INSERT INTO users_friends SET user_id = 
"'.$friend['user_id'].'", user_friend_id = "'.$user['user_id'].'"');


// Update friend count
$core->database->exec('UPDATE users_insiders SET friend_count = 
"'.++$user['friend_count'].'" WHERE user_id = "'.$user['user_id'].'"');


// E-mail sending code using phpmailer

return true;

On my Linux server, the function returns false at step #4 as it should 
do, but it appears to continue executing. The friend count is 
incremented and the page execution slows temporarily whilst the mail is 
being sent (not a problem in testing). However, no e-mail actually gets 
sent.


The key is that the function is returning false but it continues to 
execute! If I stick in an exit; after the in_array() check at point #4, 
this doesn't happen. There are no other places where this function is 
called, and it is only called once.


Strangely, if I force the values of the 2 variables
before the in_array() check:

$_SESSION['user']['friends'] = array(0 => 3);
$friend['user_id'] = 3;

it reacts as expected - the function returns false and no further code 
is executed.


Anyone have any suggestions?

Regards,

David Mytton

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



[PHP] smsSend

2007-01-22 Thread Marcelo Ferrufino Murillo

Hi guys, I´m beginner in php, so I need some help. I have to make a
script to send SMS to moviles phones, can you give some ideas how to
make it please... Thank you

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



Re: [PHP] os php scheduler?

2007-01-22 Thread David Giragosian

On 1/20/07, blackwater dev <[EMAIL PROTECTED]> wrote:


Does anyone have recommendations for an open source php based,
'lightweight', scheduling app?  I just want something clean that I can use
to schedule trainings within our company.  I need to be able to put in
details for each training and then see a synopsis on a calender.  Just a
basic scheduler but clean and useful.

Thanks!



We've used something called Meeting Room Booking ... "System", I believe
(MRBS). It's been a great help.

David


Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 15:17:16 +:
> The key is that the function is returning false but it continues to 
> execute! If I stick in an exit; after the in_array() check at point #4, 
> this doesn't happen. There are no other places where this function is 
> called, and it is only called once.
> 
> Strangely, if I force the values of the 2 variables
> before the in_array() check:
> 
> $_SESSION['user']['friends'] = array(0 => 3);
> $friend['user_id'] = 3;
> 
> it reacts as expected - the function returns false and no further code 
> is executed.
> 
> Anyone have any suggestions?

You have a bug somewhere in your code.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread David Mytton
I can't see how there is a bug in my code if when I echo the contents of 
the 2 variables, they are exactly the same as when I set them manually. 
Except in the former the function "continues executing" but in the 
latter it doesn't.


I also cannot see how the function can return false and execute the SQl 
query when it is only called once.


David

Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2007-01-22 15:17:16 +:
The key is that the function is returning false but it continues to 
execute! If I stick in an exit; after the in_array() check at point #4, 
this doesn't happen. There are no other places where this function is 
called, and it is only called once.


Strangely, if I force the values of the 2 variables
before the in_array() check:

$_SESSION['user']['friends'] = array(0 => 3);
$friend['user_id'] = 3;

it reacts as expected - the function returns false and no further code 
is executed.


Anyone have any suggestions?


You have a bug somewhere in your code.



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



Re: [PHP] smsSend

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 11:17:55 -0400:
> Hi guys, I´m beginner in php, so I need some help. I have to make a
> script to send SMS to moviles phones, can you give some ideas how to
> make it please... Thank you

Are you new to PHP or SMS?  What specific problems do you have?  Did you
google for "php sms gateway"?

If you came here for a complete menu, sorry: TANSTAAFL (before you ask:
google for "define tanstaafl").

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 15:31:55 +:
> Roman Neuhauser wrote:
> ># [EMAIL PROTECTED] / 2007-01-22 15:17:16 +:
> >>The key is that the function is returning false but it continues to 
> >>execute! If I stick in an exit; after the in_array() check at point #4, 
> >>this doesn't happen. There are no other places where this function is 
> >>called, and it is only called once.
> >>
> >>Strangely, if I force the values of the 2 variables
> >>before the in_array() check:
> >>
> >>$_SESSION['user']['friends'] = array(0 => 3);
> >>$friend['user_id'] = 3;
> >>
> >>it reacts as expected - the function returns false and no further code 
> >>is executed.
> >>
> >>Anyone have any suggestions?
> >
> >You have a bug somewhere in your code.
>
> I can't see how there is a bug in my code if when I echo the contents of 
> the 2 variables, they are exactly the same as when I set them manually. 
> Except in the former the function "continues executing" but in the 
> latter it doesn't.
> 
> I also cannot see how the function can return false and execute the SQl 
> query when it is only called once.

You have presented no proof that there's a bug in the PHP.  What you
have presented looks like you have a bug, and the function gets called
more than once.  Have you used a debugger? See http://xdebug.org/.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



RE: [PHP] smsSend

2007-01-22 Thread Jay Blanchard
[snip]
 Hi guys, I´m beginner in php, so I need some help. I have to make a
script to send SMS to moviles phones, can you give some ideas how to
make it please... Thank you
[/snip]

SMS can be sent to mobiles as an email.  Most cellphone providers offer a 
gateway for this.  See:

http://www.tech-recipes.com/rx/939/sms_email_cingular_nextel_sprint_tmobile_verizon_virgin

for more information and a list of major carriers (for the US at least).

 

Regards,

Jesse R. Castro

Applications Developer, Pocket Communications [EMAIL PROTECTED]

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread David Mytton
Yes, I know it looks like a bug in my code because I'm not able to write 
a test case that can reproduce it simply enough to report as a bug - 
hence why I am posting here. However, the behaviour I am describing 
surely suggests some kind of issue somewhere in PHP itself.


My reasoning for this is if I echo the 2 variables I get:

Array ( [0] => 3 )
and
3

and the bug appears. But if I set them manually before the in_array test:

$_SESSION['user']['friends'] = array(0 => 3);
$friend['user_id'] = 3;

it works as expected. Am I wrong in thinking that this has to be a bug 
in PHP?


I have used debug_backtrace() to find out what is going on as regards 
how many times the function is being executed - that is the first thing 
I checked because it does indeed suggest that it is being executed 
multiple times, however, the back trace only reveals 1 call/execution.


David

Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2007-01-22 15:31:55 +:

Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2007-01-22 15:17:16 +:
The key is that the function is returning false but it continues to 
execute! If I stick in an exit; after the in_array() check at point #4, 
this doesn't happen. There are no other places where this function is 
called, and it is only called once.


Strangely, if I force the values of the 2 variables
before the in_array() check:

$_SESSION['user']['friends'] = array(0 => 3);
$friend['user_id'] = 3;

it reacts as expected - the function returns false and no further code 
is executed.


Anyone have any suggestions?

You have a bug somewhere in your code.
I can't see how there is a bug in my code if when I echo the contents of 
the 2 variables, they are exactly the same as when I set them manually. 
Except in the former the function "continues executing" but in the 
latter it doesn't.


I also cannot see how the function can return false and execute the SQl 
query when it is only called once.


You have presented no proof that there's a bug in the PHP.  What you
have presented looks like you have a bug, and the function gets called
more than once.  Have you used a debugger? See http://xdebug.org/.



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



Re: [PHP] Help With Inventory

2007-01-22 Thread Jim Lucas

Here is my rendition of your script.  Give it a shot...

Let me know if you have any question about what is going on.

I was curious, what is the point of having the alternating column 
colors?  Was that your intention?



.dvdDisplay th {
font-size: 9pt;
text-align: left;
}
.dvdDisplay td {
font-size: 8pt;
}



{$row['dvdId']
{$row['dvdTitle']}
{$row['dvdGenre']}
{$row['dvdGenre2']}
{$row['dvdGenre3']}
{$row['dvdActive']}
{$row['dvdOnHand']}
{$row['backordered']}
{$row['dvdHoldRequests']}
{$row['incomingInverntory']}
{$row['ogUserId']}
{$row['outDate']}
{$row['outUserId']}
{$row['inDate']}
{$row['inUserId']}
{$row['cycles']}


HEREDOC;

$count++;

echo '';
}
}

?>

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



Re: [PHP] wierd slash

2007-01-22 Thread Jim Lucas

Don wrote:
magic_quotes_gpc On On 
magic_quotes_runtime Off Off 
magic_quotes_sybase Off Off


but I know if I can change that

is there some other way to fix this problem?

Don



# [EMAIL PROTECTED] / 2007-01-20 21:50:48 -0700:

I have a line of code that validates form info for some POST vars, but not
others.

if (!ereg("^[A-Za-z' -]{1,50}$",$_POST[$field]) )

when I put O'Toole in the form to test, my script kicks the page back (I
thought this entry would be OK)

but moreover, when it redisplays the form and populates the new form with
the entries previously entered, O'Toole becomes O\


magic_quotes_gpc?


stripslashes() ?

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Robert Cummings
On Mon, 2007-01-22 at 16:36 +, David Mytton wrote:
> Yes, I know it looks like a bug in my code because I'm not able to write 
> a test case that can reproduce it simply enough to report as a bug - 
> hence why I am posting here. However, the behaviour I am describing 
> surely suggests some kind of issue somewhere in PHP itself.
> 
> My reasoning for this is if I echo the 2 variables I get:
> 
> Array ( [0] => 3 )
> and
> 3
> 
> and the bug appears. But if I set them manually before the in_array test:
> 
> $_SESSION['user']['friends'] = array(0 => 3);
> $friend['user_id'] = 3;
> 
> it works as expected. Am I wrong in thinking that this has to be a bug 
> in PHP?
> 
> I have used debug_backtrace() to find out what is going on as regards 
> how many times the function is being executed - that is the first thing 
> I checked because it does indeed suggest that it is being executed 
> multiple times, however, the back trace only reveals 1 call/execution.

A backtrace won't indicate multiple calls unless they are recursive. Try
add the following to your function:



Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread David Mytton
I added this in and it outputs 1 as I suspected - the function is being 
called only once.


David

Robert Cummings wrote:

On Mon, 2007-01-22 at 16:36 +, David Mytton wrote:
Yes, I know it looks like a bug in my code because I'm not able to write 
a test case that can reproduce it simply enough to report as a bug - 
hence why I am posting here. However, the behaviour I am describing 
surely suggests some kind of issue somewhere in PHP itself.


My reasoning for this is if I echo the 2 variables I get:

Array ( [0] => 3 )
and
3

and the bug appears. But if I set them manually before the in_array test:

$_SESSION['user']['friends'] = array(0 => 3);
$friend['user_id'] = 3;

it works as expected. Am I wrong in thinking that this has to be a bug 
in PHP?


I have used debug_backtrace() to find out what is going on as regards 
how many times the function is being executed - that is the first thing 
I checked because it does indeed suggest that it is being executed 
multiple times, however, the back trace only reveals 1 call/execution.


A backtrace won't indicate multiple calls unless they are recursive. Try
add the following to your function:



Cheers,
Rob.


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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
Please don't top post and trim the quoted material if you want me to
discuss this with you.

# [EMAIL PROTECTED] / 2007-01-22 16:36:40 +:
> Roman Neuhauser wrote:
> ># [EMAIL PROTECTED] / 2007-01-22 15:31:55 +:
> >>I also cannot see how the function can return false and execute the SQl 
> >>query when it is only called once.
> >
> >You have presented no proof that there's a bug in the PHP.  What you
> >have presented looks like you have a bug, and the function gets called
> >more than once.  Have you used a debugger? See http://xdebug.org/.
> 
> Yes, I know it looks like a bug in my code because I'm not able to write 
> a test case that can reproduce it simply enough to report as a bug - 

Write tests that prove the code does what you think it does. Which of
these tests will break?

> However, the behaviour I am describing surely suggests some kind of
> issue somewhere in PHP itself.

I still have no reason to believe it.  Such a bug in PHP would require
memory corruption in the Zend engine.  I run complex code in 5.2 on Linux,
and haven't seen anything like that.

> My reasoning for this is if I echo the 2 variables I get:
> 
> Array ( [0] => 3 )
> and
> 3
> 
> and the bug appears. But if I set them manually before the in_array test:
> 
> $_SESSION['user']['friends'] = array(0 => 3);
> $friend['user_id'] = 3;
> 
> it works as expected. Am I wrong in thinking that this has to be a bug 
> in PHP?

You haven't shown the complete code, and what you *have* shown didn't
prove anything. Show me that it really gets past the return. var_dump() the
two things your comparing there with in_array() *after* the if() block,
and prove that it's in the same invocation as that return false.

function f()
{
static $x = 0;
$i++;
if (!in_array($friend, $friends)) {
var_dump("inside", $i, $friend, $friends);
return false;
}
var_dump("after", $i, $friend, $friends);
$core->database->exec(...);
}

> I have used debug_backtrace() to find out what is going on as regards 
> how many times the function is being executed - that is the first thing 
> I checked because it does indeed suggest that it is being executed 
> multiple times, however, the back trace only reveals 1 call/execution.

Not suprprising. This code outputs

#0  f(1) called at [/usr/home/roman/tmp/scratch30:8]
#0  f(2) called at [/usr/home/roman/tmp/scratch30:8]

http://bash.org/?255991

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Jim Lucas

David Mytton wrote:

Hi,

I have come across what appears to be a bug in PHP, but one that I am 
having difficulty writing test code for. Also, the bug only happens on a 
Linux build of PHP - the code is working as expected on Windows. This is 
on both PHP 5.2.0 and the very latest snapshots:


Windows: 5.2.1RC4-dev Jan 19 2007 16:16:57
Linux: PHP Version 5.2.1RC4-dev Jan 22 2007 11:54:28 
(php5.2-200701221130.tar.gz)


The configure line is:

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-curl' 
'--with-freetype-dir=/usr' '--with-gd' '--with-gettext' 
'--with-jpeg-dir=/usr' '--with-mysql' '--with-openssl' 
'--with-pdo-mysql' '--with-pear' '--with-png-dir=/usr' '--with-zlib' 
'--enable-calendar' '--enable-exif' '--enable-gd-native-ttf' 
'--enable-pdo' '--enable-soap' '--enable-sockets'


and no 3rd party extensions are enabled.

The code that is causing the problem exists within a class in a function 
called approve_friend. This is called by a "public" page with a 
parameter provided in GET being passed to the function approve_friend:


$username = filter_input(INPUT_GET, 'username', FILTER_SANITIZE_STRING);
if (!empty($username))
{
  if ($username != $_SESSION['user']['username'])
  {   
if ($core->user->add_friend($username))

{
  echo 1;
}
else
{
  echo 2;
}
  }
}

There is code in place of echo 1 and echo 2 but it's not relevant. Here, 
the code checks to make sure the username submitted is the not the same 
as the currently logged in use. If not, it will execute the 
$core->user->add_friend function.


add_friend runs through as follows:

1. Makes a call to $this->get_user where it gets data for the username 
$username provided when calling the function. It returns an array.


$friend = $this->get_user(1, NULL, $username);

2. Grabs some data from the session about the currently logged in user

$user['name'] = filter_var($_SESSION['user']['name'], 
FILTER_SANITIZE_STRING);
$user['user_id'] = filter_var($_SESSION['user']['user_id'], 
FILTER_SANITIZE_NUMBER_INT);
$user['username'] = filter_var($_SESSION['user']['username'], 
FILTER_SANITIZE_STRING);
$user['friend_count'] = filter_var($_SESSION['user']['friend_count'], 
FILTER_SANITIZE_NUMBER_INT);


3. Checks to make sure $friend has a value

if (empty($friend))
{
  return false;
}

4. Checks to make sure that the friend being added is not already added.

if (!empty($_SESSION['user']['friends']))
{
  if (in_array($friend['user_id'], $_SESSION['user']['friends']))
  {
return false;
  }
}

This is the point at which there is a problem. If I add this code before 
#4:


print_r($_SESSION['user']['friends']);
echo $friend['user_id']; exit;

Then I get the following output:

Array ( [0] => 3 ) 3

i.e. $_SESSION['user']['friends'] is an array with the key 0 and the 
value 3 and $friend['user_id'] has a value of 3. Therefore, the 
in_array() check above will return true and the function will return 
false. No further code in the function should execute. This is what 
happens on Windows - 2 is output to the page because the add_friend 
function has returned false.


Now, after #4, there is more code. This code is only supposed to execute 
if the friend doesn't already exist - it adds the friend, increments the 
friend count and sends an e-mail.


// Insert into friends
$core->database->exec('INSERT INTO users_friends SET user_id = 
"'.$user['user_id'].'", user_friend_id = "'.$friend['user_id'].'", 
status = 1');
$core->database->exec('INSERT INTO users_friends SET user_id = 
"'.$friend['user_id'].'", user_friend_id = "'.$user['user_id'].'"');


// Update friend count
$core->database->exec('UPDATE users_insiders SET friend_count = 
"'.++$user['friend_count'].'" WHERE user_id = "'.$user['user_id'].'"');


// E-mail sending code using phpmailer

return true;

On my Linux server, the function returns false at step #4 as it should 
do, but it appears to continue executing. The friend count is 
incremented and the page execution slows temporarily whilst the mail is 
being sent (not a problem in testing). However, no e-mail actually gets 
sent.


The key is that the function is returning false but it continues to 
execute! If I stick in an exit; after the in_array() check at point #4, 
this doesn't happen. There are no other places where this function is 
called, and it is only called once.


Strangely, if I force the values of the 2 variables
before the in_array() check:

$_SESSION['user']['friends'] = array(0 => 3);
$friend['user_id'] = 3;

it reacts as expected - the function returns false and no further code 
is executed.


Anyone have any suggestions?

Regards,

David Mytton

At the very bottom of your function place another return with a string 
like return 'FOUND THE END OF FUNCTION';


now, echo the return of the function and see if it really the return 
function that you think it is that is returning false, or you are just 
hitting the end of the function.


Jim

--
PHP General Mailing List (http://www.php

Re: [PHP] Function returning but continues execution

2007-01-22 Thread David Mytton
At the very bottom of your function place another return with a string 
like return 'FOUND THE END OF FUNCTION';


now, echo the return of the function and see if it really the return 
function that you think it is that is returning false, or you are just 
hitting the end of the function.


Jim



Yeah I tried this - I have confirmed that the return is the one I think 
it is.


However, it seems this is actually being caused by some weirdness with 
mod_rewrite. Basically, if I use the rewritten URL e.g.


example.com/section/addfriend/will/ which rewrites to 
index.php?cmd=section/addfriend&username=will


I get this bug. But if I access 
index.php?cmd=section/addfriend&username=will directly then it works fine.


This is definitely not a bug in my code but something to do with PHP, 
Apache and/or mod_rewrite.


Unless anyone can suggest otherwise, I think it's going to be far too 
complex to debug and produce a test case because of the complexity of 
the code and working out where the bug actually is in PHP, Apache or 
mod_rewrite. So I'm just going to work around it.


David

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 17:45:23 +:
> However, it seems this is actually being caused by some weirdness with 
> mod_rewrite. Basically, if I use the rewritten URL e.g.
> 
> example.com/section/addfriend/will/ which rewrites to 
> index.php?cmd=section/addfriend&username=will
> 
> I get this bug. But if I access 
> index.php?cmd=section/addfriend&username=will directly then it works fine.
> 
> This is definitely not a bug in my code but something to do with PHP, 
> Apache and/or mod_rewrite.

Can we see your mod_rewrite configuration? RewriteCond, RewriteRule, all
that jazz.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread David Mytton

Roman Neuhauser wrote:

Can we see your mod_rewrite configuration? RewriteCond, RewriteRule, all
that jazz.


There are a number of rules but the only one that is relevant for this 
page is:


RewriteRule ^section/addfriend(/)?(.*)$ 
index.php?cmd=section/addfriend&username=$2


David

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 18:48:27 +:
> Roman Neuhauser wrote:
> >Can we see your mod_rewrite configuration? RewriteCond, RewriteRule, all
> >that jazz.
> 
> There are a number of rules but the only one that is relevant for this 
> page is:
> 
> RewriteRule ^section/addfriend(/)?(.*)$ 
> index.php?cmd=section/addfriend&username=$2

Ok, what does RewriteLog contain for one such request?
RewriteLogLevel 9.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] Embeded image on mail()

2007-01-22 Thread Bagus Nugroho
Hi All,
 
It was possible to send embeded image on mail() function.
Curently, I'm using linked image to send image on mail.
 
Thanks in advance
bn








Re: [PHP] Embeded image on mail()

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-23 02:10:45 +0700:
> It was possible to send embeded image on mail() function.
> Curently, I'm using linked image to send image on mail.

Yes, see RFC2045 and perhaps http://pear.php.net/package/Mail_Mime

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread David Mytton

Roman Neuhauser wrote:

Ok, what does RewriteLog contain for one such request?
RewriteLogLevel 9.


http://paste.lisp.org/display/35779

David

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



Re: [PHP] Embeded image on mail()

2007-01-22 Thread Pinter Tibor (tibyke)

so what?

t

Bagus Nugroho wrote:

Hi All,
 
It was possible to send embeded image on mail() function.

Curently, I'm using linked image to send image on mail.
 
Thanks in advance

bn









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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 19:28:29 +:
> Roman Neuhauser wrote:
> >Ok, what does RewriteLog contain for one such request?
> >RewriteLogLevel 9.
> 
> http://paste.lisp.org/display/35779

As you can see, the processing doesn't stop when it hits the RewriteRule
you thought was the only relevant (lines 6, 7):

91.84.87.114 - - [22/Jan/2007:19:20:56 +] 
[example.com/sid#91e8128][rid#9235280/initial] (3) [perdir 
/home/example/public_html/] applying pattern '^section/addfriend(/)?(.*)$' to 
uri 'section/addfriend/will'
91.84.87.114 - - [22/Jan/2007:19:20:56 +] 
[example.com/sid#91e8128][rid#9235280/initial] (2) [perdir 
/home/example/public_html/] rewrite 'section/addfriend/will' -> 
'index.php?cmd=section/addfriend&username=will'

I think this paragraph from the apache manual applies to you:

# Note: When you use this flag, make sure that the substitution field is
# a valid URL! Otherwise, you will be redirecting to an invalid
# location. Remember that this flag on its own will only prepend
# http://thishost[:thisport]/ to the URL, and rewriting will continue.
# Usually, you will want to stop rewriting at this point, and redirect
# immediately. To stop rewriting, you should add the 'L' flag.


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 20:45:42 +:
> # [EMAIL PROTECTED] / 2007-01-22 19:28:29 +:
> > Roman Neuhauser wrote:
> > >Ok, what does RewriteLog contain for one such request?
> > >RewriteLogLevel 9.
> > 
> > http://paste.lisp.org/display/35779
> 
> As you can see, the processing doesn't stop when it hits the RewriteRule
> you thought was the only relevant (lines 6, 7):
> 
> 91.84.87.114 - - [22/Jan/2007:19:20:56 +] 
> [example.com/sid#91e8128][rid#9235280/initial] (3) [perdir 
> /home/example/public_html/] applying pattern '^section/addfriend(/)?(.*)$' to 
> uri 'section/addfriend/will'
> 91.84.87.114 - - [22/Jan/2007:19:20:56 +] 
> [example.com/sid#91e8128][rid#9235280/initial] (2) [perdir 
> /home/example/public_html/] rewrite 'section/addfriend/will' -> 
> 'index.php?cmd=section/addfriend&username=will'
> 
> I think this paragraph from the apache manual applies to you:

Bzzzt, I'm an idiot.  It doesn't, of course.  You're still missing [L]
and that's what I was trying to point you at until the cat ran over my
keyboard...


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Embeded image on mail()

2007-01-22 Thread Sergiu Voicu

There is a nice website with tons of PHP classes:
http://www.phpclasses.org

Once I have found on it a class that was doing what you need now (send 
emails with attachements in it). Can't remember the name, but I'm sure 
that you can find it.


Sergiu


Bagus Nugroho wrote:

Hi All,
 
It was possible to send embeded image on mail() function.

Curently, I'm using linked image to send image on mail.
 
Thanks in advance

bn









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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread David Mytton

Roman Neuhauser wrote:

Bzzzt, I'm an idiot.  It doesn't, of course.  You're still missing [L]
and that's what I was trying to point you at until the cat ran over my
keyboard...


Alright. So if the rewrite rules were (and they are):

RewriteRule ^section/account(/)?$ index.php?cmd=section/account
RewriteRule ^section/addfriend(/)?(.*)$ 
index.php?cmd=section/addfiend&username=$2
RewriteRule ^section/approvefriend(/)?(.*)$ 
index.php?cmd=section/approvefriend&username=$
RewriteRule ^section/deletefriend(/)?(.*)$ 
index.php?cmd=section/deletefriend&username=$2

RewriteRule ^section(/)?$ index.php?cmd=section/index

RewriteRule ^anothersection(/)?(.*)$ 
index.php?cmd=listingnav&url=anothersection/$2


Where would the correct place be?

David

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



[PHP] ouput the contents of a folder for download

2007-01-22 Thread Ross
I want to output the file contents of a folder to a php page and provide a 
link for them to be downloaded.

This is what I have so far but I cannot get a filename or get it to iterate 
through all the files in a folder.

 

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 19:56:58 +:
> Roman Neuhauser wrote:
> >Bzzzt, I'm an idiot.  It doesn't, of course.  You're still missing [L]
> >and that's what I was trying to point you at until the cat ran over my
> >keyboard...
> 
> Alright. So if the rewrite rules were (and they are):
> 
> RewriteRule ^section/account(/)?$ index.php?cmd=section/account
> RewriteRule ^section/addfriend(/)?(.*)$ 
> index.php?cmd=section/addfiend&username=$2
> RewriteRule ^section/approvefriend(/)?(.*)$ 
> index.php?cmd=section/approvefriend&username=$
> RewriteRule ^section/deletefriend(/)?(.*)$ 
> index.php?cmd=section/deletefriend&username=$2
> RewriteRule ^section(/)?$ index.php?cmd=section/index
> 
> RewriteRule ^anothersection(/)?(.*)$ 
> index.php?cmd=listingnav&url=anothersection/$2
> 
> Where would the correct place be?

append [L,NS] to all RewriteRules


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] ouput the contents of a folder for download

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 20:25:49 -:
> $dir = "mydirectory";
> 
> // Open a known directory, and proceed to read its contents
> if (is_dir($dir)) {
>if ($dh = opendir($dir)) {
>while (($file = readdir($dh)) !== false) {
> 
> echo  filetype($file) . "\n";
>  echo filesize($file);
>}
>closedir($dh);
>}
> }
> 
> 
> This is what I have so far but I cannot get a filename or get it to iterate 
> through all the files in a folder.

What does it do instead?

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread David Mytton

Roman Neuhauser wrote:

append [L,NS] to all RewriteRules


Done that, but the problem is still there - doesn't seem to have made 
any difference.


David

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 21:17:04 +:
> Roman Neuhauser wrote:
> >append [L,NS] to all RewriteRules
> 
> Done that, but the problem is still there - doesn't seem to have made 
> any difference.

Can I see the rewrite log for a single request now? Please make sure
it's only one request.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] Network Time Protocol

2007-01-22 Thread Ron Piggott
Where could I get instructions to set up a network time protocol through
my web site hosting server?  Ron

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread David Mytton

Roman Neuhauser wrote:

Can I see the rewrite log for a single request now? Please make sure
it's only one request.


http://paste.lisp.org/display/35791

David

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 22:03:30 +:
> Roman Neuhauser wrote:
> >Can I see the rewrite log for a single request now? Please make sure
> >it's only one request.
> 
> http://paste.lisp.org/display/35791

Are you sure you added the NS flag? It looks like the RewriteRules
are applied to the result of the original rewrite.

And, I see TWO requests for addfriend:

rewrite 'section/addfriend/will' -> 
'index.php?cmd=section/addfriend&username=will'
rewrite 'section/addfriend/templates/js/jquery.js' -> 
'index.php?cmd=section/addfriend&username=templates/js/jquery.js'


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Network Time Protocol

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 16:44:32 -0500:
> Where could I get instructions to set up a network time protocol through
> my web site hosting server?  Ron

enter "man ntpd" on your web site hosting server.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] [HELP] Fatal error when uploading large files!

2007-01-22 Thread Jay Paulson
Hi everyone,

Hopefully you all can help!  I¹m at a loss as to what to do next.  I¹m
running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the
following PHP error when trying to upload a larger file.  I have
AllowOverride turned on in the httpd.conf file so my .htaccess file is below
as well.  When I look at phpinfo() it reflects the changes in the .htaccess
file but yet still I get the following PHP fatal error.  Anyone have any
ideas what could be going on?  Could it be the Zend Memory Manager
(something that I know nothing about)?  Or anything else I may not be aware
of?

Any help would be greatly appreciated!


Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to
allocate 19590657 bytes) in /path/to/php/file on line 979

LimitRequestBody 0
php_value memory_limit 40M
php_value post_max_size 30M
php_value upload_max_filesize 30M
php_value display_errors On
php_value max_execution_time 300
php_value max_input_time 300


[PHP] exec('make') Q

2007-01-22 Thread james
Here's a simple makefile I want PHP's exec to execute make on:

KEYLIST := keylist.txt
DEPS := $(wildcard *.txt)
FILES := *.txt

$(KEYLIST): $(DEPS)
grep ^keywords $(FILES) > $@

now when I use make from command line, it works as expected,
the keylist.txt file is created. however, when I use PHP exec
to run make on the makefile, the keylist.txt file is not generated.

* if keylist.txt does not need updating, PHP exec make works,
make says keylist.txt is up to date.
* if i remove redirection, PHP exec make shows that grep is
making the same matches as make from commandline.

Why does the redirection of the grep command (within the makefile)
only work when I execute make from the commandline but not from
PHP exec||shell_exec?

One sollution is to abandon redirection and get the output from
grep into a string and then get PHP to create keylist.txt, but
why do that?

Any help appreciated.
Cheers,
James.

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



Re: [PHP] [HELP] Fatal error when uploading large files!

2007-01-22 Thread Jim Lucas

Jay Paulson wrote:

Hi everyone,

Hopefully you all can help!  I¹m at a loss as to what to do next.  I¹m
running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the
following PHP error when trying to upload a larger file.  I have
AllowOverride turned on in the httpd.conf file so my .htaccess file is below
as well.  When I look at phpinfo() it reflects the changes in the .htaccess
file but yet still I get the following PHP fatal error.  Anyone have any
ideas what could be going on?  Could it be the Zend Memory Manager
(something that I know nothing about)?  Or anything else I may not be aware
of?

Any help would be greatly appreciated!


Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to
allocate 19590657 bytes) in /path/to/php/file on line 979

LimitRequestBody 0
php_value memory_limit 40M
php_value post_max_size 30M
php_value upload_max_filesize 30M
php_value display_errors On
php_value max_execution_time 300
php_value max_input_time 300



doesn't seem to me that it is following the directives for memory size

OR or you are up against a 20mb disk quota possibly???

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



[PHP] preg_match problem

2007-01-22 Thread Beauford
I'm trying to get this but not quite there. I want to allow the following
characters.

[EMAIL PROTECTED]&()*;:_.'/\ and a space.

Is there a special order these need to be in or escaped somehow. For
example, if I just allow _' the ' is fine, if I add the other characters,
the ' gets preceded by a \ and an error is returned. If I take the ' out of
the sting below it works fine, I get no errors returned. I am also using
stripslashes on the variable.

This is my code. (although I have tried various things with it trying to get
it right)

if(preg_match("/[EMAIL PROTECTED]&\(\)\*;:_.\'\$ ]+$/", $string)) {

Thanks

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



Re: [PHP] exec('make') Q

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 23:45:09 +:
> Here's a simple makefile I want PHP's exec to execute make on:
> 
> KEYLIST := keylist.txt
> DEPS := $(wildcard *.txt)
> FILES := *.txt
> 
> $(KEYLIST): $(DEPS)
> grep ^keywords $(FILES) > $@

Does that line in the real Makefile begin with a tab? It must.

Why is it so roundabout about $(DEPS)/$(FILES)? The target *actuall*
depends on different files than those declared in the sources list!

What does $(DEPS) (and $(FILES)) contain?

This is what your Makefile does, BTW:

  grep ^keywords keylist.txt ... > keylist.txt

Try it with this instead (rename keylist.txt to key.list), but make sure
you have at least one file ending in .txt in that directory first!):

KEYLIST := key.list
FILES := $(wildcard *.txt)

$(KEYLIST): $(FILES) ; grep '^keywords' $^ > $@

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] preg_match problem

2007-01-22 Thread Paul Novitski

At 1/22/2007 03:04 PM, Beauford wrote:

I'm trying to get this but not quite there. I want to allow the following
characters.

[EMAIL PROTECTED]&()*;:_.'/\ and a space.

Is there a special order these need to be in or escaped somehow. For
example, if I just allow _' the ' is fine, if I add the other characters,
the ' gets preceded by a \ and an error is returned. If I take the ' out of
the sting below it works fine, I get no errors returned. I am also using
stripslashes on the variable.

This is my code. (although I have tried various things with it trying to get
it right)

if(preg_match("/[EMAIL PROTECTED]&\(\)\*;:_.\'\$ ]+$/", $string)) {



Please read this page:

Pattern Syntax -- Describes PCRE regex syntax
http://ca.php.net/manual/en/reference.pcre.pattern.syntax.php

specifically the section on character classes:
http://ca.php.net/manual/en/reference.pcre.pattern.syntax.php#regexp.reference.squarebrackets

In PREG there are few characters that you need to escape in a 
character class expression:


1) ^ must be escaped (\^) if it's the first character (it negates the 
match when it's unescaped in the first position).


2) ] must be escaped (\]) unless it's the first character of the 
class (it closes the class if it appears later and is not escaped).


3) \ must be escaped (\\) if you're referring to the backslash 
character rather than using backslash to escape another character.


4) Control codes such as \b for backspace (not to be confused with \b 
which means word boundary outside of a character class).



In addition, you may need to escape certain characters in PHP if 
you're expressing the RegExp pattern in a quoted string, such as 
single or double quotes (whichever you're using to quote the pattern):


'[\'"]'  escape the apostophe
"['\"]"  escape the quotation mark

Those are PHP escapes -- by the time PREG sees the pattern, the PHP 
compiler has rendered it to:


['"]

And then of course there's the complication that both PREG and PHP 
use the backslash as the escape character, so the pattern:


[\\]  escape the backslash

must be expressed in PHP as:

[]  escape the escape and the backslash

Interestingly, PHP compiles both \\\ and  as \\, go figure.  I 
use  to escape both backslashes to maintain some semblance of 
logic and order in these eye-crossing expressions.


Because PHP requires quotes to be escaped, I find it easier to write 
& debug patterns in PHP if I express them in heredoc where quoting 
and most escaping is unnecessary:


$sPattern = <<<_
['"]
_;

becomes the PREG pattern ['"\\].


So to address your character class:


[EMAIL PROTECTED]&()*;:_.'/\ and a space.


I'd use the pattern:

[EMAIL PROTECTED]&()*;:_.'/\\ ]

where the only character I need to escape is the backslash itself.

In PHP this would be:

$sPattern = '[EMAIL PROTECTED]&()*;:_.\'/ ]';
(escaped apostrophe & blackslash)
or:
$sPattern = "[EMAIL PROTECTED]&()*;:_.'/ ]";
(escaped blackslash)
or:
$sPattern = <<<_
[EMAIL PROTECTED]&()*;:_.'/ ]
_;
(escaped blackslash)

Regards,

Paul
__

Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Normalized Numbers

2007-01-22 Thread Brian P. Giroux


Roman Neuhauser wrote:
-- 
Brian P. Giroux
Sénécal & Associé.e.s / Associates
Recherche et marketing / Research and marketing
Tél : (705) 476-9667
Fax : (705) 476-1618
www.senecal.ca> # [EMAIL PROTECTED] / 2007-01-14 14:51:30 -0500:
>> I tried to install Testilence on my Ubuntu using Gnu make 3.81beta4(my
>> skills as a Linux administrator are weaker than my PHP skills) but was
>> unsuccessful :(
> 
> What problems did you have?

Well, I had a few problems following the "wash and go" instructions...

First off, I am using 64bit Ubuntu 6.06LTS.

I don't have "fetch" so I just downloaded it with my web browser.

Next, the tar command "tar -xzf
testilence-0.0.0.snap200701051209.tar.bz2" forces my version of tar (GNU
tar 1.15.1) to use gzip so I just did a "tar -xvf testil" and that
worked fine.

The "cd testil" worked as expected ;)

And finally the "make check install" gave the following:

| env TENCE_TESTS_TARGET=tencetest_SafeTests make _check
| phpflags="-d include_path=$(pwd)/src:$(make -s _include-path)"; \
| /usr/bin/env php $phpflags src/tence/tence --run
| tests/alltests.php tencetest_SafeTests
|
| Fatal error: Call to undefined method ReflectionClass::newInstanceArgs()
| in /root/testilence-0.0.0.snap200701051209/src/tence/main.php on line
| 196
| make[1]: *** [_check] Error 255
| make: *** [check] Error 2

If I was more comfortable I could probably poke at it a bit and get it
to work, but right now, I'd probably poke at the wrong thing and break
the whole system. :(

-- 
Brian P. Giroux

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



Re: [PHP] [HELP] Fatal error when uploading large files!

2007-01-22 Thread Jochem Maas
Jay Paulson wrote:
> Hi everyone,
> 
> Hopefully you all can help!  I¹m at a loss as to what to do next.  I¹m
> running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the
> following PHP error when trying to upload a larger file.  I have
> AllowOverride turned on in the httpd.conf file so my .htaccess file is below
> as well.  When I look at phpinfo() it reflects the changes in the .htaccess
> file but yet still I get the following PHP fatal error.  Anyone have any
> ideas what could be going on?  Could it be the Zend Memory Manager
> (something that I know nothing about)?  Or anything else I may not be aware
> of?
> 
> Any help would be greatly appreciated!
> 
> 
> Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to
> allocate 19590657 bytes) in /path/to/php/file on line 979
> 
> LimitRequestBody 0
> php_value memory_limit 40M
> php_value post_max_size 30M
> php_value upload_max_filesize 30M
> php_value display_errors On
> php_value max_execution_time 300
> php_value max_input_time 300

php_value can't overrule a php_admin_value (your apache conf or another 
.htaccess
maybe setting these ini settings usiong php_admin_value).

check that the php ini settings you've got in your .htaccess are
actually being honored:

foreach (array('memory_limit','post_max_size','upload_max_filesize') as $ini)
echo ini_get($ini),'';

> 

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



RE: [PHP] preg_match problem

2007-01-22 Thread Beauford
 

> -Original Message-
> From: Paul Novitski [mailto:[EMAIL PROTECTED] 
> Sent: January 22, 2007 6:58 PM
> To: PHP
> Subject: Re: [PHP] preg_match problem
> 
> At 1/22/2007 03:04 PM, Beauford wrote:
> >I'm trying to get this but not quite there. I want to allow the 
> >following characters.
> >
> >[EMAIL PROTECTED]&()*;:_.'/\ and a space.
> >
> >Is there a special order these need to be in or escaped somehow. For 
> >example, if I just allow _' the ' is fine, if I add the other 
> >characters, the ' gets preceded by a \ and an error is 
> returned. If I 
> >take the ' out of the sting below it works fine, I get no errors 
> >returned. I am also using stripslashes on the variable.
> >
> >This is my code. (although I have tried various things with 
> it trying 
> >to get it right)
> >
> >if(preg_match("/[EMAIL PROTECTED]&\(\)\*;:_.\'\$ ]+$/", $string)) {
> 
> 
> Please read this page:
> 
> Pattern Syntax -- Describes PCRE regex syntax 
> http://ca.php.net/manual/en/reference.pcre.pattern.syntax.php
> 
> specifically the section on character classes:
> http://ca.php.net/manual/en/reference.pcre.pattern.syntax.php#
> regexp.reference.squarebrackets
> 
> In PREG there are few characters that you need to escape in a 
> character class expression:
> 
> 1) ^ must be escaped (\^) if it's the first character (it 
> negates the match when it's unescaped in the first position).
> 
> 2) ] must be escaped (\]) unless it's the first character of 
> the class (it closes the class if it appears later and is not 
> escaped).
> 
> 3) \ must be escaped (\\) if you're referring to the 
> backslash character rather than using backslash to escape 
> another character.
> 
> 4) Control codes such as \b for backspace (not to be confused 
> with \b which means word boundary outside of a character class).
> 
> 
> In addition, you may need to escape certain characters in PHP if 
> you're expressing the RegExp pattern in a quoted string, such as 
> single or double quotes (whichever you're using to quote the pattern):
> 
>  '[\'"]'  escape the apostophe
>  "['\"]"  escape the quotation mark
> 
> Those are PHP escapes -- by the time PREG sees the pattern, the PHP 
> compiler has rendered it to:
> 
>  ['"]
> 
> And then of course there's the complication that both PREG and PHP 
> use the backslash as the escape character, so the pattern:
> 
>  [\\]  escape the backslash
> 
> must be expressed in PHP as:
> 
>  []  escape the escape and the backslash
> 
> Interestingly, PHP compiles both \\\ and  as \\, go figure.  I 
> use  to escape both backslashes to maintain some semblance of 
> logic and order in these eye-crossing expressions.
> 
> Because PHP requires quotes to be escaped, I find it easier to write 
> & debug patterns in PHP if I express them in heredoc where quoting 
> and most escaping is unnecessary:
> 
> $sPattern = <<<_
> ['"]
> _;
> 
> becomes the PREG pattern ['"\\].
> 
> 
> So to address your character class:
> 
> >[EMAIL PROTECTED]&()*;:_.'/\ and a space.
> 
> I'd use the pattern:
> 
>  [EMAIL PROTECTED]&()*;:_.'/\\ ]
> 
> where the only character I need to escape is the backslash itself.
> 
> In PHP this would be:
> 
>  $sPattern = '[EMAIL PROTECTED]&()*;:_.\'/ ]';
>  (escaped apostrophe & blackslash)
> or:
>  $sPattern = "[EMAIL PROTECTED]&()*;:_.'/ ]";
>  (escaped blackslash)
> or:
>  $sPattern = <<<_
> [EMAIL PROTECTED]&()*;:_.'/ ]
> _;
>  (escaped blackslash)

I've probably read 100 pages on this, and no matter what I try it doesn't
work. Including all of what you suggested above - is my PHP possessed? 

if(preg_match("/[EMAIL PROTECTED]&()*;:_.'/\\ ]+$/", $string)) { gives me
this error.

Warning: preg_match() [function.preg-match]: Unknown modifier '\' in
/constants.php on line 107

So if If you wouldn't mind, could you show me exactly what I need right from
the beginning and explain why it works.

i.e. 

if(preg_match(what goes here", $string)) {
Echo "You got it";  

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



RE: [PHP] preg_match problem

2007-01-22 Thread Paul Novitski

At 1/22/2007 04:56 PM, Beauford wrote:

I've probably read 100 pages on this, and no matter what I try it doesn't
work. Including all of what you suggested above - is my PHP possessed?

if(preg_match("/[EMAIL PROTECTED]&()*;:_.'/\\ ]+$/", $string)) { gives me
this error.

Warning: preg_match() [function.preg-match]: Unknown modifier '\' in
/constants.php on line 107

So if If you wouldn't mind, could you show me exactly what I need right from
the beginning and explain why it works.

i.e.

if(preg_match(what goes here", $string)) {
Echo "You got it";



Beauford,

Because you're using forward slashes /.../ to delimit your pattern, 
regexp is using the / in your character class to terminate your pattern:


/[EMAIL PROTECTED]&()*;:_.'/

Then it's looking at the subsequent characters as pattern modifiers 
and gacking on the backslash.  Even if you had a character there that 
it could accept as a pattern modifier, the character class would be 
incomplete (no closing bracket) so the pattern is doomed to fail.


You need to escape that forward slash in the character class:

preg_match("/[EMAIL PROTECTED]&()*;:_.'\/

Also, you've got only two backslashes in your char class.  PHP is 
reducing this to a single backslash before the space character.  I 
think you intend this to be two backslashes in the pattern so you 
need four backslashes in PHP:


preg_match("/[EMAIL PROTECTED]&()*;:_.'\/ ]+$/", $string)

Regards,

Paul
__

Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Jochem Maas
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-22 22:03:30 +:
>> Roman Neuhauser wrote:
>>> Can I see the rewrite log for a single request now? Please make sure
>>> it's only one request.
>> http://paste.lisp.org/display/35791
> 
> Are you sure you added the NS flag? It looks like the RewriteRules
> are applied to the result of the original rewrite.
> 
> And, I see TWO requests for addfriend:
> 
> rewrite 'section/addfriend/will' -> 
> 'index.php?cmd=section/addfriend&username=will'
> rewrite 'section/addfriend/templates/js/jquery.js' -> 
> 'index.php?cmd=section/addfriend&username=templates/js/jquery.js'

and what's the bet that this second rewritten url is the bogey man here.

there is no way in hell that [a released version of] php is so borked that it's 
capable
returning a value from a function and then going on to running code that occurs 
in the function
after the return statement that returned the value. no way, no how.

> 
> 

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Robert Cummings
On Tue, 2007-01-23 at 02:43 +0100, Jochem Maas wrote:
>
> there is no way in hell that [a released version of] php is so borked that 
> it's capable
> returning a value from a function and then going on to running code that 
> occurs in the function
> after the return statement that returned the value. no way, no how.

Borked for PHP sure... but there are languages where that semantic is
perfectly valid :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Php coding help - Newbie question

2007-01-22 Thread Chris



Sorry for troubling all again.
I am trying to use the Pear DB_ldap for the above scripts.

Does any one have any sample code for ldap_connect () ldap_search etc.


http://php.net/ldap_connect

http://php.net/ldap_search

Both pages have examples.

If you have a specific problem then post it.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Jochem Maas
Robert Cummings wrote:
> On Tue, 2007-01-23 at 02:43 +0100, Jochem Maas wrote:
>> there is no way in hell that [a released version of] php is so borked that 
>> it's capable
>> returning a value from a function and then going on to running code that 
>> occurs in the function
>> after the return statement that returned the value. no way, no how.
> 
> Borked for PHP sure... 

it's the lang I know best, I think you'll agree that it's *highly* unlikely 
such an
extreme level of brokeness (as far as php is concerned) would creep into a 
release version.

> but there are languages where that semantic is
> perfectly valid :)

I would not have thought so but then again my skills and experience are somewhat
limited in the grand scheme of things.

you've twanged my interest, please name the language you were thinking of
when you wrote that last comment :-)

> 
> Cheers,
> Rob.

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



Re: [PHP] Function returning but continues execution

2007-01-22 Thread Robert Cummings
On Tue, 2007-01-23 at 03:01 +0100, Jochem Maas wrote:
> Robert Cummings wrote:
> > On Tue, 2007-01-23 at 02:43 +0100, Jochem Maas wrote:
> >> there is no way in hell that [a released version of] php is so borked that 
> >> it's capable
> >> returning a value from a function and then going on to running code that 
> >> occurs in the function
> >> after the return statement that returned the value. no way, no how.
> > 
> > Borked for PHP sure... 
> 
> it's the lang I know best, I think you'll agree that it's *highly* unlikely 
> such an
> extreme level of brokeness (as far as php is concerned) would creep into a 
> release version.
> 
> > but there are languages where that semantic is
> > perfectly valid :)
> 
> I would not have thought so but then again my skills and experience are 
> somewhat
> limited in the grand scheme of things.
> 
> you've twanged my interest, please name the language you were thinking of
> when you wrote that last comment :-)

Well, my own BlobbieScript supports a retval keyword that returns a
value to the caller and then continues on as a separate thread. But I
can't take credit for the concept. I spoke with an imp of another MUD
that mentioned it in passing, so I implemented the functionality
realizing it's utility. So I know at least one other language supports
it, and not my own, but I'm not aware of it's name.

Why would you do it? Imagine a function in a game script that is invoked
for a return value, but upon probing for that return value an action is
triggered. Depending on when you want that action to trigger you can
either do it before returning the value or wait until afterwards. Some
languages would have you set up timed event handler (such as
setTimeout() in JavaScript), but why bother if you're already running...
instead just sleep until ready... this delayed action is what follows
the return value and removes the cumbersome nature of setting up an
event handler. The additional advantage of this method is you retain all
the variables of the current calling scope without having to either pass
them along or create a closure with an anonymous function.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] JPEG info needed

2007-01-22 Thread Gerry D

I need PHP to find out if a jpeg file uses progressive encoding. None
of the standard exif or image functions seem to be able to tell me
that. (please correct me if I'm wrong)

Can anybody help me?

TIA

Gerry

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



[PHP] where match question

2007-01-22 Thread Don
I have a db field that contains zip codes separated by comas.

I am trying to get php to return all of the rows that contain a particular
zip code.

 

$query = "SELECT * FROM info WHERE MATCH (partialZIP) AGAINST ('$zip')";

$result = mysql_query($query)

or die ("could not connect to db");

$row = mysql_fetch_row($result);

 

 

this works if there is only one row that contains that zip code.

 

If there is more than one row that contains the zip, it returns 0 rows.
('It' being MYSQL that returns 0 rows. I checked this by running the query
directly to the DB)

 

Any ideas are very much appreciated.

 

Thanks,

 

Don

 

 



[PHP] using return in include files

2007-01-22 Thread Aaron Axelsen
I'm trying to figure out what the desired behavior is of using the
return function to bail out of an include page.

I did some testing, and this is what I concluded.

First, I created the following file:

";
?>

I then called it as follows:
include('test.php');
include('test.php');
include('test.php');

The output is:
blah blah blah blah

Second, I changed the test.php file to be the following:

";

function myFunc($test) {

}
?>

When I load the page now, it throws the following error: PHP Fatal
error: Cannot redeclare myfunc()

It appears that if there are functions in the include page that you
can't use return to bail out.  What is the desired functionality in this
case?  Is this a bug in how php handles it? or was return never designed
to be used this way?

Any thoughts are appreciated.

-- 
Aaron Axelsen
[EMAIL PROTECTED]

Great hosting, low prices.  Modevia Web Services LLC -- http://www.modevia.com

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



Re: [PHP] where match question

2007-01-22 Thread Chris

Don wrote:

I have a db field that contains zip codes separated by comas.

I am trying to get php to return all of the rows that contain a particular
zip code.

 


$query = "SELECT * FROM info WHERE MATCH (partialZIP) AGAINST ('$zip')";

$result = mysql_query($query)

or die ("could not connect to db");

$row = mysql_fetch_row($result);


http://php.net/mysql_fetch_assoc has a better example.

When there are many rows returned you need to loop to show them all:

while ($row = mysql_fetch_assoc($result)) {
  print_r($row);
}

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] using return in include files

2007-01-22 Thread Chris

Aaron Axelsen wrote:

I'm trying to figure out what the desired behavior is of using the
return function to bail out of an include page.

I did some testing, and this is what I concluded.

First, I created the following file:

";
?>

I then called it as follows:
include('test.php');
include('test.php');
include('test.php');

The output is:
blah blah blah blah

Second, I changed the test.php file to be the following:

";

function myFunc($test) {

}
?>

When I load the page now, it throws the following error: PHP Fatal
error: Cannot redeclare myfunc()

It appears that if there are functions in the include page that you
can't use return to bail out.  What is the desired functionality in this
case?  Is this a bug in how php handles it? or was return never designed
to be used this way?


It's not a bug.

When you include a file, the whole file is loaded in to memory.

Then php decides (based on your code decisions) about what to do with 
all of that code.



See http://www.php.net/include, specifically:

If there are functions defined in the included file, they can be used in 
the main file independent if they are before return() or after. If the 
file is included twice, PHP 5 issues fatal error because functions were 
already declared, while PHP 4 doesn't complain about functions defined 
after return().


--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP] Re: using return in include files

2007-01-22 Thread Gregory Beaver
Aaron Axelsen wrote:
> I'm trying to figure out what the desired behavior is of using the
> return function to bail out of an include page.
> 
> I did some testing, and this is what I concluded.
> 
> First, I created the following file:
> 
>  if (defined('TEST_LOADED')) {
> return;
> }
> define('TEST_LOADED',true);
> echo "blah blah blah blah";
> ?>
> 
> I then called it as follows:
> include('test.php');
> include('test.php');
> include('test.php');
> 
> The output is:
> blah blah blah blah
> 
> Second, I changed the test.php file to be the following:
> 
>  if (defined('TEST_LOADED')) {
> return;
> }
> define('TEST_LOADED',true);
> echo "blah blah blah blah";
> 
> function myFunc($test) {
> 
> }
> ?>
> 
> When I load the page now, it throws the following error: PHP Fatal
> error: Cannot redeclare myfunc()
> 
> It appears that if there are functions in the include page that you
> can't use return to bail out.  What is the desired functionality in this
> case?  Is this a bug in how php handles it? or was return never designed
> to be used this way?
> 
> Any thoughts are appreciated.

Hi Aaron,

Unfortunately, the only way you can prevent the parse error is to use a
conditional function, return won't cut is, as the file is re-parsed
every time you include it, and all classes/functions are re-parsed
before the run-time if() is processed.



This will work, but does slow down opcode caches and introduce potential
instability with them, as the added complexity is very unfriendly to
optimization.

Of course, you are much better off taking advantage of the
include_once[1] language construct, or separating your
need-to-be-included-many-times file from any function or class definitions.

Greg

http://www.php.net/include_once

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



RE: [PHP] where match question

2007-01-22 Thread Don
I appreciate your quick response, but I think the problem I'm having is in
the query. Is WHERE MATCH () the proper format to use for getting multiple
rows from the DB? Or is there something else I'm missing?


Don wrote:
> I have a db field that contains zip codes separated by comas.
> 
> I am trying to get php to return all of the rows that contain a particular
> zip code.
> 
>  
> 
> $query = "SELECT * FROM info WHERE MATCH (partialZIP) AGAINST ('$zip')";
> 
> $result = mysql_query($query)
> 
> or die ("could not connect to db");
> 
> $row = mysql_fetch_row($result);

http://php.net/mysql_fetch_assoc has a better example.

When there are many rows returned you need to loop to show them all:

while ($row = mysql_fetch_assoc($result)) {
   print_r($row);
}

-- 
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] where match question

2007-01-22 Thread Chris

Don wrote:

I appreciate your quick response, but I think the problem I'm having is in
the query. Is WHERE MATCH () the proper format to use for getting multiple
rows from the DB? Or is there something else I'm missing?


Please don't top post, it's hard to follow what's going on and who's 
replied.


Sorry, I misread your email.

"Match against" is meant to be for fulltext searches, that includes some 
limitations.


http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html

Specifically the last 3-4 paragraphs.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP] having trouble with is_file() and is_dir() on 5.1.2

2007-01-22 Thread jekillen

Hello php developers:
I am having a problem with the following code:
OS: FreeBSD v6.0
Apache 1.3.34
php 5.1.2
-> $cont is an array produced from opening and reading a
directory:
for($i = 0; $i < count($cont); $i++)
 {
   print $cont[$i].'';
if(is_file($cont[$i]))
  {
 print "is file: ".$cont[$i].'';
 //array_push($files, $cont[$i]);
}
   else if(is_dir($cont[$i]))
{
print "is dir: ".$cont[$i]."";
 //array_push($dirs, $cont[$i]);
 }
  }

The print statements produce the following:

collections
groups
in
index.php
lists.php
new_multi.php
new_single.php
out
pref_code
pref_funct.php
process.php
requests
rlists
routing.php
send.php
steps.php
store
templates

is dir: templates  <- only directory recognized (extra line breaks 
added here for readability)


usr_config.php
usr_pref.php

everything without an extension is a directory
You will notice that the only directory detected
by this code is templates. There are no files
detected by this code. Does this have something
to do with stat cache? I want to make one array
with directories and one array with files. I can't
see any syntax or logic problems.
Thanks in advance;
JK

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



Re: [PHP] having trouble with is_file() and is_dir() on 5.1.2

2007-01-22 Thread Chris

jekillen wrote:

Hello php developers:
I am having a problem with the following code:
OS: FreeBSD v6.0
Apache 1.3.34
php 5.1.2
-> $cont is an array produced from opening and reading a
directory:
for($i = 0; $i < count($cont); $i++)
 {
   print $cont[$i].'';
if(is_file($cont[$i]))
  {
 print "is file: ".$cont[$i].'';
 //array_push($files, $cont[$i]);
}
   else if(is_dir($cont[$i]))
{
print "is dir: ".$cont[$i]."";
 //array_push($dirs, $cont[$i]);
 }
  }



I'd be guessing it's a path issue.

Try prefixing the is_dir and is_file calls with the path to the 
directory they are in:


$basedir = '/whatever';

for($i = 0; $i < count($cont); $i++) {
  $fullpath = $basedir . '/' . $cont[$i];
  if (is_file($fullpath)) {
  .
}

--
Postgresql & php tutorials
http://www.designmagick.com/

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



RE: [PHP] having trouble with is_file() and is_dir() on 5.1.2

2007-01-22 Thread Ligaya A. Turmelle
Haven't really looked at it - but elseif is one word - or do you mean
else then an if...

Respectfully,
Ligaya Turmelle

-Original Message-
From: jekillen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 23, 2007 4:03 PM
To: PHP General List
Subject: [PHP] having trouble with is_file() and is_dir() on 5.1.2

Hello php developers:
I am having a problem with the following code:
OS: FreeBSD v6.0
Apache 1.3.34
php 5.1.2
-> $cont is an array produced from opening and reading a
directory:
for($i = 0; $i < count($cont); $i++)
  {
print $cont[$i].'';
 if(is_file($cont[$i]))
   {
  print "is file: ".$cont[$i].'';
  //array_push($files, $cont[$i]);
 }
else if(is_dir($cont[$i]))
 {
 print "is dir: ".$cont[$i]."";
  //array_push($dirs, $cont[$i]);
  }
   }

The print statements produce the following:

collections
groups
in
index.php
lists.php
new_multi.php
new_single.php
out
pref_code
pref_funct.php
process.php
requests
rlists
routing.php
send.php
steps.php
store
templates

is dir: templates  <- only directory recognized (extra line breaks added
here for readability)

usr_config.php
usr_pref.php

everything without an extension is a directory You will notice that the
only directory detected by this code is templates. There are no files
detected by this code. Does this have something to do with stat cache? I
want to make one array with directories and one array with files. I
can't see any syntax or logic problems.
Thanks in advance;
JK

--
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] where match question

2007-01-22 Thread Don

Don wrote:
> I have a db field that contains zip codes separated by comas.
> 
> I am trying to get php to return all of the rows that contain a particular
> zip code.
> 
>  
> 
> $query = "SELECT * FROM info WHERE MATCH (partialZIP) AGAINST ('$zip')";
> 
> $result = mysql_query($query)
> 
> or die ("could not connect to db");
> 
> $row = mysql_fetch_row($result);

http://php.net/mysql_fetch_assoc has a better example.

When there are many rows returned you need to loop to show them all:

while ($row = mysql_fetch_assoc($result)) {
   print_r($row);
}

Don wrote:
> I appreciate your quick response, but I think the problem I'm having 
> is in the query. Is WHERE MATCH () the proper format to use for 
> getting multiple rows from the DB? Or is there something else I'm 
> missing?

Please don't top post, it's hard to follow what's going on and who's 
replied.

Sorry, I misread your email.

"Match against" is meant to be for fulltext searches, that includes some 
limitations.

http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html

Specifically the last 3-4 paragraphs.



~~~

Alright,

I learned 2 things
What top post islol (sorry)

And don't' skim through the manual programming isn't like legos where
you can look at the picture and put it together

query = "SELECT * FROM info WHERE MATCH (partialZIP) AGAINST ('$zip' in
Boolean mode)";

Made all the difference... I missed the part about stop words and had only 2
entries in my DB.

So thanks for pointing that out.

Don

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



Re: [PHP] Php coding help - Newbie question

2007-01-22 Thread Ramdas

On 1/23/07, Chris <[EMAIL PROTECTED]> wrote:


> Sorry for troubling all again.
> I am trying to use the Pear DB_ldap for the above scripts.
>
> Does any one have any sample code for ldap_connect () ldap_search etc.

http://php.net/ldap_connect

http://php.net/ldap_search

Both pages have examples.

If you have a specific problem then post it.

--
Postgresql & php tutorials
http://www.designmagick.com/


Thanx for replying Chris.

I am in process to modify my existing php scripts to a more neater/compact code.

In current scripts certain code ( ldap_connect , ldap_bind , if connet
error show error page etc ) is repeated many times.

This makes the scripts very bulky and even small changes that need to
be done are very difficult to implement.

That's why I am looking for some thing with a ready functions for the
above which I can use. I believe PEAR DB_ldap has it. But very little
documentation is avaliable.

So I was searching for any sample scripts.

-
My current script:
user edit page


on update


The problem is, for separate edit pages I have written separate update
pages. Any new object to edit needs a new edit page & a relevent
update page.

I believe if I can use functions this can be reduced to just one
update page with fewer edit pages.

Very sorry for this long mail.

Thanx & Regards
Ram

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



Re: [PHP] where match question

2007-01-22 Thread Jim Lucas

Don wrote:

I have a db field that contains zip codes separated by comas.

I am trying to get php to return all of the rows that contain a particular
zip code.

 


$query = "SELECT * FROM info WHERE MATCH (partialZIP) AGAINST ('$zip')";


try this

$query = "SELECT * FROM info WHERE column LIKE '{$zip}'";



$result = mysql_query($query)

or die ("could not connect to db");

$row = mysql_fetch_row($result);

 

 


this works if there is only one row that contains that zip code.

 


If there is more than one row that contains the zip, it returns 0 rows.
('It' being MYSQL that returns 0 rows. I checked this by running the query
directly to the DB)

 


Any ideas are very much appreciated.

 


Thanks,

 


Don

 

 





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



Re: [PHP] Help With Inventory

2007-01-22 Thread Brandon Bearden
Thank you for your help. I see what you are doing different. I don't 
understand how the quotient works there. I will sometime. I also don't 
understand the HEREDOC concept.

I wanted colors alternating to allow for a better read.

I still have not solved the problem with listing the genre in its own row, 
alone at the beginning of each section of genre (the start of each unique 
genre which is the ORDER BY in the statement).

Thanks for the code. I need to learn how to write more eloquently like you.

If anyone can figure out the a row listing for the genres, that would be 
s cool.

"Jim Lucas" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Here is my rendition of your script.  Give it a shot...
>
> Let me know if you have any question about what is going on.
>
> I was curious, what is the point of having the alternating column colors? 
> Was that your intention?
>
> 
> function invlistONE(){
> dbconnect('connect');
> $invlist = mysql_query("SELECT * FROM sp_dvd
> ORDER BY dvdGenre");
>
>
> echo <<
> 
> .dvdDisplay th {
> font-size: 9pt;
> text-align: left;
> }
> .dvdDisplay td {
> font-size: 8pt;
> }
> 
>
>  } else {
> $rowColor = '';
> }
>
> echo <<
> 
> {$row['dvdId']
> {$row['dvdTitle']}
> {$row['dvdGenre']}
> {$row['dvdGenre2']}
> {$row['dvdGenre3']}
> {$row['dvdActive']}
> {$row['dvdOnHand']}
> {$row['backordered']}
> {$row['dvdHoldRequests']}
> {$row['incomingInverntory']}
> {$row['ogUserId']}
> {$row['outDate']}
> {$row['outUserId']}
> {$row['inDate']}
> {$row['inUserId']}
> {$row['cycles']}
> 
>
> HEREDOC;
>
> $count++;
>
> echo '';
> }
> }
>
> ?> 

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



Re: [PHP] Help With Inventory

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 22:55:50 -0800:
> "Jim Lucas" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> > $count = 0;
> > while ( $row = mysql_fetch_array( $invlist ) ) {
> >
> > if ( $count % 1 ) {
> > $rowColor = '#c1c1c1';
> > } else {
> > $rowColor = '';
> > }
> >
> > echo << >
> > 
> > {$row['dvdId']
> > {$row['dvdTitle']}
> > {$row['dvdGenre']}
> > {$row['dvdGenre2']}
> > {$row['dvdGenre3']}
> > {$row['dvdActive']}
> > {$row['dvdOnHand']}
> > {$row['backordered']}
> > {$row['dvdHoldRequests']}
> > {$row['incomingInverntory']}
> > {$row['ogUserId']}
> > {$row['outDate']}
> > {$row['outUserId']}
> > {$row['inDate']}
> > {$row['inUserId']}
> > {$row['cycles']}
> > 
> >
> > HEREDOC;
> >
> > $count++;
> >
> > echo '';
> > }
> > }
> >

> I don't understand how the quotient works there. I will sometime.
> I also don't understand the HEREDOC concept.
> 
> I wanted colors alternating to allow for a better read.
 
Ignore the heredoc thing, the "quotient" (remainder after division)
works just like it worked in your math class, but it should be

if ( $count % 2 ) {
$rowColor = '#c1c1c1';
} else {
$rowColor = '';
}

Although I'd use

$rowColors = array('', '#c1c1c1');
...
$rowColor = $rowColors[$count % 2];

> I still have not solved the problem with listing the genre in its own row, 
> alone at the beginning of each section of genre (the start of each unique 
> genre which is the ORDER BY in the statement).
> 
> Thanks for the code. I need to learn how to write more eloquently like you.
> 
> If anyone can figure out the a row listing for the genres, that would be 
> s cool.

You want something like this?

genre  | #id | title | #id | title | #id | title
---+-+---+-+---+-+
horror | 123 | Scary Movie 1 | 456 | Scary Movie 2 | ... | 
comedy | 234 | Funny Movie 1 | 456 | Funny Movie 2 | ... | 


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] having trouble with is_file() and is_dir() on 5.1.2

2007-01-22 Thread clive



everything without an extension is a directory
You will notice that the only directory detected
by this code is templates. There are no files
detected by this code. Does this have something
to do with stat cache? I want to make one array
with directories and one array with files. I can't
see any syntax or logic problems.
Thanks in advance;
JK



As far as I know is_dir and is_file require a full path , as chris 
mentioned, how are you populating $cont;


clive

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



Re: [PHP] Help With Inventory

2007-01-22 Thread Brandon Bearden
What I WANT to see is something like this

DVD ID | TITLE  |   GENRE 1   |   GENRE 2  | GENRE 3  |  ACT  | 
QTY BCK   |HLD  |  INC | OG USR |  OUT DATE  | OUT USR  |  IN DATE  | 
IN USR  CY

GENRE: ACTION - 1 TITLES
20860023  |  Movie name  |  ACTION  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0

GENRE: COMEDY - 2 TITLES
20860023  |  Movie name  |  COMEDY  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0
20860006  |  Movie name  |  COMEDY  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0




What I HAVE RIGHT NOW IS:

DVD ID | TITLE  |   GENRE 1   |   GENRE 2  | GENRE 3  |  ACT  | 
QTY BCK   |HLD  |  INC | OG USR |  OUT DATE  | OUT USR  |  IN DATE  | 
IN USR  CY

20860023  |  Movie name  |  ACTION  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0
20860023  |  Movie name  |  COMEDY  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0
20860006  |  Movie name  |  COMEDY  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0


Thanks for you help :) I appreciate it very much.


"Roman Neuhauser" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
># [EMAIL PROTECTED] / 2007-01-22 22:55:50 -0800:
>> "Jim Lucas" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > $count = 0;
>> > while ( $row = mysql_fetch_array( $invlist ) ) {
>> >
>> > if ( $count % 1 ) {
>> > $rowColor = '#c1c1c1';
>> > } else {
>> > $rowColor = '';
>> > }
>> >
>> > echo <<> >
>> > 
>> > {$row['dvdId']
>> > {$row['dvdTitle']}
>> > {$row['dvdGenre']}
>> > {$row['dvdGenre2']}
>> > {$row['dvdGenre3']}
>> > {$row['dvdActive']}
>> > {$row['dvdOnHand']}
>> > {$row['backordered']}
>> > {$row['dvdHoldRequests']}
>> > {$row['incomingInverntory']}
>> > {$row['ogUserId']}
>> > {$row['outDate']}
>> > {$row['outUserId']}
>> > {$row['inDate']}
>> > {$row['inUserId']}
>> > {$row['cycles']}
>> > 
>> >
>> > HEREDOC;
>> >
>> > $count++;
>> >
>> > echo '';
>> > }
>> > }
>> >
>
>> I don't understand how the quotient works there. I will sometime.
>> I also don't understand the HEREDOC concept.
>>
>> I wanted colors alternating to allow for a better read.
>
> Ignore the heredoc thing, the "quotient" (remainder after division)
> works just like it worked in your math class, but it should be
>
>if ( $count % 2 ) {
>$rowColor = '#c1c1c1';
>} else {
>$rowColor = '';
>}
>
> Although I'd use
>
>$rowColors = array('', '#c1c1c1');
>...
>$rowColor = $rowColors[$count % 2];
>
>> I still have not solved the problem with listing the genre in its own 
>> row,
>> alone at the beginning of each section of genre (the start of each unique
>> genre which is the ORDER BY in the statement).
>>
>> Thanks for the code. I need to learn how to write more eloquently like 
>> you.
>>
>> If anyone can figure out the a row listing for the genres, that would be
>> s cool.
>
> You want something like this?
>
> genre  | #id | title | #id | title | #id | title
> ---+-+---+-+---+-+
> horror | 123 | Scary Movie 1 | 456 | Scary Movie 2 | ... | 
> comedy | 234 | Funny Movie 1 | 456 | Funny Movie 2 | ... | 
>
>
> -- 
> How many Vietnam vets does it take to screw in a light bulb?
> You don't know, man.  You don't KNOW.
> Cause you weren't THERE. http://bash.org/?255991 

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



Re: [PHP] having trouble with is_file() and is_dir() on 5.1.2

2007-01-22 Thread jekillen


On Jan 22, 2007, at 10:20 PM, Chris wrote:


jekillen wrote:

Hello php developers:
I am having a problem with the following code:
OS: FreeBSD v6.0
Apache 1.3.34
php 5.1.2
-> $cont is an array produced from opening and reading a
directory:
for($i = 0; $i < count($cont); $i++)
 {
   print $cont[$i].'';
if(is_file($cont[$i]))
  {
 print "is file: ".$cont[$i].'';
 //array_push($files, $cont[$i]);
}
   else if(is_dir($cont[$i]))
{
print "is dir: ".$cont[$i]."";
 //array_push($dirs, $cont[$i]);
 }
  }



I'd be guessing it's a path issue.

Try prefixing the is_dir and is_file calls with the path to the 
directory they are in:


$basedir = '/whatever';

for($i = 0; $i < count($cont); $i++) {
  $fullpath = $basedir . '/' . $cont[$i];
  if (is_file($fullpath)) {
  .
}

--
Postgresql & php tutorials
http://www.designmagick.com/


Ok, I hope I can get this to work. The code
I copied here was code that was in the directory
reading loop, where I would have guess that
it would have the path info, but it did the same
thing. But I will take you suggestion.
Thanks for the reply;
JK

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



Re: [PHP] Normalized Numbers

2007-01-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-22 19:36:50 -0500:
> Roman Neuhauser wrote:
> www.senecal.ca> # [EMAIL PROTECTED] / 2007-01-14 14:51:30 -0500:
> >> I tried to install Testilence on my Ubuntu using Gnu make 3.81beta4(my
> >> skills as a Linux administrator are weaker than my PHP skills) but was
> >> unsuccessful :(
> > 
> > What problems did you have?
> 
> Well, I had a few problems following the "wash and go" instructions...
> 
> First off, I am using 64bit Ubuntu 6.06LTS.
> 
> I don't have "fetch" so I just downloaded it with my web browser.
> 
> Next, the tar command "tar -xzf
> testilence-0.0.0.snap200701051209.tar.bz2" forces my version of tar (GNU
> tar 1.15.1) to use gzip so I just did a "tar -xvf testil" and that
> worked fine.

Sorry, it says tar.gz and tar -xzf, while the actual tarball names end
with tar.bz2 (the tars are bzip2ed). Thanks for pointing out the
problem, I just fixed it.
 
> And finally the "make check install" gave the following:
> 
> | env TENCE_TESTS_TARGET=tencetest_SafeTests make _check
> | phpflags="-d include_path=$(pwd)/src:$(make -s _include-path)"; \
> | /usr/bin/env php $phpflags src/tence/tence --run
> | tests/alltests.php tencetest_SafeTests
> |
> | Fatal error: Call to undefined method ReflectionClass::newInstanceArgs()
> | in /root/testilence-0.0.0.snap200701051209/src/tence/main.php on line

What version of PHP do you have? Please send me (privately) your
php -v
php -m

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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