[svn:PHP-Sandwich] rev 1082 - in PHP-Sandwich/trunk: . t

[email protected] 14 Jun 2005 18:04:52 -0000
Newsgroups perl.php.sandwich.dev
Message-ID <[email protected]>
Author: gschlossnagle
Date: Tue Jun 14 11:04:52 2005
New Revision: 1082

Modified:
   PHP-Sandwich/trunk/PHP.xs
   PHP-Sandwich/trunk/t/19.t
Log:
buglets

Modified: PHP-Sandwich/trunk/PHP.xs
==============================================================================
--- PHP-Sandwich/trunk/PHP.xs	(original)
+++ PHP-Sandwich/trunk/PHP.xs	Tue Jun 14 11:04:52 2005
@@ -455,7 +455,7 @@ SV* SAND_new(classname, ...)
           }
           else if(!strcmp(trackvars_key, "FILES")) {
             track_vars_array = PG(http_globals)[TRACK_VARS_FILES];
-          } 
+          }
           else if(!strcmp(trackvars_key, "OUTPUT")) {
             sandwich_per_interp *interp = (sandwich_per_interp *)SG(server_context);
             if(interp) {
@@ -464,8 +464,8 @@ SV* SAND_new(classname, ...)
             }
           } else if(!strcmp(trackvars_key, "INCLUDE_PATH")) {
             STRLEN strlen;
-            char *str = SvPV(sv, strlen);
-            zend_alter_ini_entry("include_path", sizeof("include_path"), str, strlen);
+            char *str = SvPV(trackvars, strlen);
+            zend_alter_ini_entry("include_path", sizeof("include_path"), str, strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
           }
           else {
             /* special case - this isn't an autoglobal - register it and continue */
@@ -566,6 +566,28 @@ void SAND_DESTROY(interp)
       sandwich_interp_dec_ref(interp);
     }
 
+SV* SAND_get_output(interp)
+  PHP_Interpreter interp;
+  CODE:
+    {
+      SV* oh = interp->output_handler;
+      if(SvROK(oh) && SvPOK(SvRV(oh))) {
+        RETVAL = newSVsv(SvRV(oh));
+      }
+    }
+  OUTPUT:
+    RETVAL
+
+void SAND_clear_output(interp)
+  PHP_Interpreter interp;
+  CODE:
+    {
+      SV* oh = interp->output_handler;
+      if(SvROK(oh) && SvPOK(SvRV(oh))) {
+        sv_setpvn_mg(SvRV(oh), NULL, 0);
+      }
+    }
+  
 SV* SAND_instantiate(interp, class, ...)
   PHP_Interpreter interp;
   char *class;

Modified: PHP-Sandwich/trunk/t/19.t
==============================================================================
--- PHP-Sandwich/trunk/t/19.t	(original)
+++ PHP-Sandwich/trunk/t/19.t	Tue Jun 14 11:04:52 2005
@@ -18,6 +18,15 @@ ok my $p = PHP::Interpreter->new(
   "Create new PHP interpreter";
 $p->eval(q/print $BRIC['special'];/);
 is $output, 'data', 'check output buffering (scalar pass by ref)';
+$p->eval(q/print $BRIC['special'];/);
+is $output, 'datadata', 'check output buffering accumulation (scalar pass by ref)';
+is $p->get_output, 'datadata', 'check output buffer accessor';
+$p->clear_output;
+is $output, undef, 'check output buffering was cleared (scalar pass by ref)';
+$p->eval(q/print $BRIC['special'];/);
+is $output, 'data', 'check output buffering, post-clearing (scalar pass by ref)';
+
+
 
 
 my $output2;
@@ -32,3 +41,4 @@ ok my $p = PHP::Interpreter->new(
 
 $p->eval(q/print $BRIC['special'];/);
 is $output2, 'data', 'check output buffering (callback)';
+