node_save not responding inside module Drupal: 7.31
Php: 5.5.9-1ubuntu4.3

I am trying to create node type 'recibo_promocion_type', after create nodes of type 'offer_type' (diferent type). 
I am using hook_node_presave.
I run the code in the development environment 'run php code', successfully, but the same code within in my personal module does not respond, getting a blank page.
I did debug and the line of code that fails is 'node_save ($node)'.

function nuevo_Recibo_Promocion($nid, $uid, $ruta){ 

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
global $user;
$nodeConfigura=node_load($nid);
$node = new stdClass();
$node-&gt;nid=0;
$node-&gt;type = 'recibo_promocion_type';
$node-&gt;uid = $user-&gt;uid;
$node-&gt;name = $user-&gt;name;
$node-&gt;title = $nodeConfigura-&gt;title;
$node-&gt;language = 'es';
$node-&gt;field_organizacion = $nodeConfigura-&gt;field_organizacion;
$node-&gt;field_enlace['und'][0]['url']=$ruta;
$node-&gt;field_enlace['und'][0]['title']=$nodeConfigura-&gt;title;
$node-&gt;field_enlace['und'][0]['attributes']['target']=0;
$node-&gt;field_fecha_promocion = $nodeConfigura-&gt;field_fecha_promocion;
$node-&gt;field_cliente_envio['und'][0]['target_id'] = $uid;
node_object_prepare($node);
$node = node_submit($node);
node_save($node);


}

This is the test code with moc parameters from 'ejecute code php' of dev module, and save node successfully. 
The moc parameters was extrated from dpm($node) replace save_node($node) in a module.

//moc paraeters
$ruta='http://...';
$uid=184;
$nid =81;


$nodeConfigura=node_load($nid);
$node = new stdClass();
$node-&gt;type = 'recibo_promocion_type';
$node-&gt;uid = 1;
$node-&gt;title = $nodeConfigura-&gt;title;
$node-&gt;language = 'es';
$node-&gt;field_organizacion = $nodeConfigura-&gt;field_organizacion;
$node-&gt;field_enlace['und'][0]['url']=$ruta;
$node-&gt;field_enlace['und'][0]['title']=$nodeConfigura-&gt;title;
$node-&gt;field_enlace['und'][0]['attributes']['target']=0;
$node-&gt;field_fecha_promocion = $nodeConfigura-&gt;field_fecha_promocion;
$node-&gt;field_cliente_envio['und'][0]['target_id'] = $uid;

node_object_prepare($node);
$node = node_submit($node);
node_save($node); 


the node save successfully. 



This is the result to repace 'node_save($node)' for 'dpm($node)' in function  'nuevo_Recibo_Promocion' inside my module:


I tried also:

1)Use drupal_register_shutdown_function but the bug is the same.

2)I have created  a xmlrpc service, and replace instead the nuevo_Recibo_Promocion call function.
The xmlrpc creates successfully the node, but if it's invoked  from 'execute php code' (dev module). if xmlrpc it's invoked  from  from my module, it doesn't created the new node.

$methods = xmlrpc('http://...', array('reciboPromocion.new' => array($nid,$ruta,$uid)));

3) I have disabled all my modules to avoid confict with othes modules (loops Infinite)

4) use try{} catch(exception $e){}... to get the bug.

5) use hock_cron(), but not save the new node.

6) I've tried the user custom permissions, the function node_access($node) before node_save ($node) in two cases: my personal module  and dev console 'Run PHP code'. The result is true in all cases.

The question for  is, why  the process do not shoot any exception, alert, or notify, The result is a don't response and 'blank page' in my web browser.

any suggestion?
When you are doing node_save() inside hook_node_presave, it will trigger hook_node_presave where you have node_save()...

You could move the node_save else where. Perhaps if your using form in creating the original node just add submit handler in case the node type matches? Or some other way to by pass the infinite loop.