From 124d69bc5328308d0dad7a08dae4ab75f27b51f9 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 30 Mar 2009 01:39:05 +0200 Subject: [PATCH] Fix the arrays_global_runme.php test. The typemap for a character array was wrong, it returned one more bytes - in PHP it's unusual to have a \0 at the end of a normal string. --- Examples/test-suite/php/arrays_global_runme.php | 6 ++++-- Lib/php/php.swg | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Examples/test-suite/php/arrays_global_runme.php b/Examples/test-suite/php/arrays_global_runme.php index 59ff7bf..c422b62 100644 --- a/Examples/test-suite/php/arrays_global_runme.php +++ b/Examples/test-suite/php/arrays_global_runme.php @@ -7,8 +7,10 @@ require "arrays_global.php"; check::functions(array(test_a,test_b,new_simplestruct,new_material)); check::classes(array(arrays_global,SimpleStruct,Material)); check::globals(array(array_c,array_sc,array_uc,array_s,array_us,array_i,array_ui,array_l,array_ul,array_ll,array_f,array_d,array_struct,array_structpointers,array_ipointers,array_enum,array_enumpointers,array_const_i,beginstring_fix44a,beginstring_fix44b,beginstring_fix44c,beginstring_fix44d,beginstring_fix44e,beginstring_fix44f,chitmat,hitmat_val,hitmat)); -check::set(array_c,"hac"); -check::equal("ha",check::get(array_c,"ha"),"set array_c"); +// the size of array_c is 2, but the last byte is \0, so we can only +// store the first byte of "ha" +check::set(array_c,"ha"); +check::equal("h",check::get(array_c),"set array_c ('h' !== '".check::get(array_c)."')"); check::done(); ?> diff --git a/Lib/php/php.swg b/Lib/php/php.swg index 2843161..e36fd64 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -234,7 +234,7 @@ %typemap(out) char [ANY] %{ - RETVAL_STRINGL($1,$1_dim0,1); + RETVAL_STRINGL($1,$1_dim0-1,1); %} // This typecheck does hard checking for proper argument type. If you want -- 1.6.2.1