New to Xataface - Help with Copy Set selection

A place for users and developers of the Xataface to discuss and receive support.

New to Xataface - Help with Copy Set selection

Postby BlueDevilDan » Thu Jan 28, 2010 7:37 am

I'm new to xataface, but I have followed the getting started and set up a simple single table application which lets me enter new records and list display the contents. So far, so good.

From the main display, there is a list tab and a "copy set". I wanted to see what this default function was, so I clicked it, but the processing of that URL gives me a connection reset from the browser. I did a bit of debugging (with error_log statements) to see that this is invoking the copy_replace.php action. Within that, I have been able to see that the handle() method is invoked and it seems the php processing is crashing near the end (about 5 lines from the end of the handle function) at the line

$form->accept($this->renderer);

I don't really know from here though what the issue would be. I've just got a vanilla single table out of the box app so I would expect the default xataface application behaviors to work as they would. I would think if I had misconfigured any server side paths or such that the other functions like new record would also not function correctly. Any help would be appreciated.
BlueDevilDan
 
Posts: 11
Joined: Thu Jan 28, 2010 7:23 am

Re: New to Xataface - Help with Copy Set selection

Postby shannah » Thu Jan 28, 2010 8:17 am

What version of PHP, MySQL, Xataface are you using? Have you tried checking the error log to see what the problem is?

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: New to Xataface - Help with Copy Set selection

Postby ppd83 » Thu Jan 28, 2010 8:42 am

I too have this problem in Windows. It works fine, however, in Linux.
ppd83
 
Posts: 9
Joined: Fri Jan 08, 2010 7:41 am

Re: New to Xataface - Help with Copy Set selection

Postby shannah » Thu Jan 28, 2010 11:10 am

What setup on Windows did you have? Was it running Apache or IIS? Version of php/mysql?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: New to Xataface - Help with Copy Set selection

Postby BlueDevilDan » Thu Jan 28, 2010 11:19 am

Sorry for Omitting this information.

I'm using the Latest Windows WAMPserver, with PHP downgraded from 5.3.0 to 5.2.11
BlueDevilDan
 
Posts: 11
Joined: Thu Jan 28, 2010 7:23 am

Re: New to Xataface - Help with Copy Set selection

Postby BlueDevilDan » Thu Jan 28, 2010 11:24 am

The downgrade was to eliminate these errors that were occuring (based on some googling)

Deprecated: Assigning the return value of new by reference is deprecated in C:\WampServer\www\xataface\dataface-public-api.php on line 508

Deprecated: Function set_magic_quotes_runtime() is deprecated in C:\WampServer\www\xataface\config.inc.php on line 35
BlueDevilDan
 
Posts: 11
Joined: Thu Jan 28, 2010 7:23 am

Re: New to Xataface - Help with Copy Set selection

Postby BlueDevilDan » Thu Jan 28, 2010 11:27 am

WampServer 2.0i [11/07/09]
- Apache 2.2.11
- MySQL 5.1.36
- PHP 5.3.0 -> This I downgraded to 5.2.11
BlueDevilDan
 
Posts: 11
Joined: Thu Jan 28, 2010 7:23 am

Re: New to Xataface - Help with Copy Set selection

Postby shannah » Thu Jan 28, 2010 11:44 am

How about the error log. Any clues in there?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: New to Xataface - Help with Copy Set selection

Postby BlueDevilDan » Thu Jan 28, 2010 12:14 pm

nothing in the php error log and I just get this in the apache one

[Thu Jan 28 13:35:57 2010] [notice] Parent: child process exited with status 128 -- Restarting.
[Thu Jan 28 13:35:58 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Thu Jan 28 13:35:58 2010] [notice] Server built: Dec 10 2008 00:10:06
[Thu Jan 28 13:35:58 2010] [notice] Parent: Created child process 3384
[Thu Jan 28 13:35:58 2010] [notice] Child 3384: Child process is running
[Thu Jan 28 13:35:58 2010] [notice] Child 3384: Acquired the start mutex.
[Thu Jan 28 13:35:58 2010] [notice] Child 3384: Starting 64 worker threads.
[Thu Jan 28 13:35:58 2010] [notice] Child 3384: Starting thread to listen on port 80.

It was by adding the error-log statements into copy-replace.php I was able to determine that the above line was where things die (because the error-log statement right after it never made it to the php log.

I can try to capture more if there is something you would like me to turn on that would capture additional data.
BlueDevilDan
 
Posts: 11
Joined: Thu Jan 28, 2010 7:23 am

Re: New to Xataface - Help with Copy Set selection

Postby shannah » Thu Jan 28, 2010 12:23 pm

Great :( A segfault is very hard to track down because it is a PHP internal error and they usually don't tell us exactly what line is causing the problem. It is hard for me to debug because I can't reproduce the problem on my setup. My usual strategy is to just follow the trail by placing break points (e.g. echo "here";exit;) in various places, to try to narrow it down to a specific spot.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: New to Xataface - Help with Copy Set selection

Postby BlueDevilDan » Thu Jan 28, 2010 12:35 pm

I guess I'll try to debug into QuickForm.php for this method. Which file actually executes, the one under Dataface or the one under lib/HTML?

Also, what function is this copy set selection supposed to provide?
BlueDevilDan
 
Posts: 11
Joined: Thu Jan 28, 2010 7:23 am

Re: New to Xataface - Help with Copy Set selection

Postby BlueDevilDan » Thu Jan 28, 2010 12:37 pm

actually, the QuickForm in the Dataface directory does not have an accept method in it :-) I guess that answers that part.
BlueDevilDan
 
Posts: 11
Joined: Thu Jan 28, 2010 7:23 am

Re: New to Xataface - Help with Copy Set selection

Postby shannah » Thu Jan 28, 2010 12:56 pm

It inherits from HTML quickform which is in the lib drectory.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: New to Xataface - Help with Copy Set selection

Postby BlueDevilDan » Thu Jan 28, 2010 1:43 pm

OK, I see a trail that runs into QuickForm.accept() -> element.render() -> the Default renderer render() -> Default renderer _prepareTemplate()

Here is the altered version of that function, the bold looks to be where we die

/**
* Helper method for renderElement
*
* @param string Element name
* @param mixed Element label (if using an array of labels, you should set the appropriate template)
* @param bool Whether an element is required
* @param string Error message associated with the element
* @access private
* @see renderElement()
* @return string Html for element
*/
function _prepareTemplate($name, $label, $required, $error)
{
error_log("DefaultRenderer - _prepareTemplate1" . $name);
error_log("DefaultRenderer - _prepareTemplate2" . $label);
error_log("DefaultRenderer - _prepareTemplate3" . $required);
error_log("DefaultRenderer - _prepareTemplate4" . $error);
if (is_array($label)) {
$nameLabel = array_shift($label);
} else {
$nameLabel = $label;
}
error_log("DefaultRenderer - _prepareTemplate5");
if (isset($this->_templates[$name])) {
$html = str_replace('{label}', $nameLabel, $this->_templates[$name]);
} else {
$html = str_replace('{label}', $nameLabel, $this->_elementTemplate);
}
error_log("DefaultRenderer - _prepareTemplate6");
if ($required) {
error_log("DefaultRenderer - _prepareTemplate6a");
$html = str_replace('<!-- BEGIN required -->', '', $html);
$html = str_replace('<!-- END required -->', '', $html);
error_log("DefaultRenderer - _prepareTemplate6a1");
} else {
error_log("DefaultRenderer - _prepareTemplate6b");
$html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->(\s|\S)*<!-- END required -->([ \t\n\r]*)?/i", '', $html);
error_log("DefaultRenderer - _prepareTemplate6b1");
}
error_log("DefaultRenderer - _prepareTemplate7");
if (isset($error)) {
$html = str_replace('{error}', $error, $html);
$html = str_replace('<!-- BEGIN error -->', '', $html);
$html = str_replace('<!-- END error -->', '', $html);
} else {
$html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN error -->(\s|\S)*<!-- END error -->([ \t\n\r]*)?/i", '', $html);
}
error_log("DefaultRenderer - _prepareTemplate8");
if (is_array($label)) {
foreach($label as $key => $text) {
$key = is_int($key)? $key + 2: $key;
$html = str_replace("{label_{$key}}", $text, $html);
$html = str_replace("<!-- BEGIN label_{$key} -->", '', $html);
$html = str_replace("<!-- END label_{$key} -->", '', $html);
}
}
error_log("DefaultRenderer - _prepareTemplate9");
if (strpos($html, '{label_')) {
$html = preg_replace('/\s*<!-- BEGIN label_(\S+) -->.*<!-- END label_\1 -->\s*/i', '', $html);
}
return $html;
} // end func _prepareTemplate


PHP log info
[28-Jan-2010 20:51:31] DefaultRenderer - _prepareTemplate1-copy_replace_form:replace[milestone]
[28-Jan-2010 20:51:31] DefaultRenderer - _prepareTemplate2Milestone
[28-Jan-2010 20:51:31] DefaultRenderer - _prepareTemplate3
[28-Jan-2010 20:51:31] DefaultRenderer - _prepareTemplate4
[28-Jan-2010 20:51:31] DefaultRenderer - _prepareTemplate5
[28-Jan-2010 20:51:31] DefaultRenderer - _prepareTemplate6
[28-Jan-2010 20:51:31] DefaultRenderer - _prepareTemplate6b
BlueDevilDan
 
Posts: 11
Joined: Thu Jan 28, 2010 7:23 am

Re: New to Xataface - Help with Copy Set selection

Postby shannah » Thu Jan 28, 2010 1:56 pm

So it looks like it is dying at the preg_replace call.
Code: Select all
$html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->(\s|\S)*<!-- END required -->([ \t\n\r]*)?/i", '', $html);


What happens if you just comment this out (this isn't our final solution, but worth testing).

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Next

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 4 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved