Welcome! Log In Create A New Profile

Advanced

[PHP] Odd failure

Posted by Jeffry Killen 
Jeffry Killen
[PHP] Odd failure
April 10, 2017 10:00PM
Hello;

This is a simplistic subject line and the problem
is both subtile and not so subtile;

There is a lot of code spread over several html
files and php source files so I will try to describe
the problem as clearly as possible with out
much code.

!: I have created an html interface that is used for development
of user defined arrays and functions
2: The arrays and functions are php code that are written to
php script files. This allows the user to chose sample arrays
and sample functions to work with.
3: The purpose of this application is to develop a class definition
in php that has at its core a recursive function for recursing over
arrays; specifically multidimensional arrays.
4: The arrays it recurses over are the sample arrays saved in files
5: It has a built in function that produces a formatted string representation
of the target array. It is working well enough.
6: I also has a public method to use to install one of the user defined functions
for use.

The problem:

I have significant amount of javascript to prepare an async "ajax" get request
for the server to use this class definition to parse the array using the designated
user function.

Using the same javascript and php code to process the async request,
If I designate the default function to be used, everything works as expected.

AND, if I designate one of the user defined, external functions:

The get request will not return at all; event if I comment all the processing code
and have it return an arbitrary string to test.

The external function code is not sent, only the path/file to the source. The source
file is, in turn required by the class object instance and the function is assigned to
a private static variable.

But even with this step commented out, the async request will not return anything.
If I designate the default built in function, the arbitrary string is returned (with relevant
code commented out). I have written the javascript so the exact same code is used
for both cases. But if there are coding problems, I should get some kind of error indication
file not found or the result is screwed up somehow.

Is this a security issue? Something seems to be anticipating something base on the
get variables in the request.

Thank you for time and attention
JK

code to process async request: You can see all the relevant code commented out.

if($_GET['async'] == 'true' && isset($_GET['opr']) && $_GET['opr'] == 'pars')
{
//require($_GET['arraySrc']); // contains $_sample
header('Content-Type: text/plain');
print "Hello?...";
exit;
/*
require('php/arrayRecursorREV-2.php');
$_restult ='';
$_test = new _ARRAY_RECURSOR();
$_params = array
(
'target'=>$_sample,
'codeLabel'=>$_GET['functLabel']
);
if(isset($_GET['functSrc']) && $_GET['functSrc'] != '')
{
$_params['code'] = $_GET['functSrc']; // path/file name of source
}
$_result = $_test->run('test', $_params);
if(isset($_result['error']))
{
print $_result['error'];
}
else
{
print $_result;
}
exit;*/
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login